Revision
66
Author
emsmith
Date
2006-12-10 14:02:36 -0800 (Sun, 10 Dec 2006)

Log Message

Todo additions and very basic writer class so you can see what cc_main looks like unadorned

Modified Paths

Diff

Modified: desktop/trunk/docs/todo.txt (65 => 66)


--- desktop/trunk/docs/todo.txt	2006-12-10 21:49:34 UTC (rev 65)
+++ desktop/trunk/docs/todo.txt	2006-12-10 22:02:36 UTC (rev 66)
@@ -1,5 +1,10 @@
 Current Integration:
-get customize toolbars working (need some treeview stuff done)
+
+1. Generic Help Window (a la mozilla only with textbuffer - reads docbook?)
+2. Generic About (similiar to splash)
+3. Generic Treeview (with working dnd)
+
+customize still needs reset to default and comboboxes for changing icon size and toolbar style
 character window abstracted out (because places will be almost exactly the same) and added back in (we were up to meta data there)
 about dialog base (similiar to splash base - just point to the files)
 drag onto windows implements import, drag off of windows implements export

Modified: desktop/trunk/programs/writer/lib/writer.class.php (65 => 66)


--- desktop/trunk/programs/writer/lib/writer.class.php	2006-12-10 21:49:34 UTC (rev 65)
+++ desktop/trunk/programs/writer/lib/writer.class.php	2006-12-10 22:02:36 UTC (rev 66)
@@ -24,422 +24,27 @@
  *
  * Basically a wrapper class for the application
  */
-class CC_Writer extends CC_Window
+class CC_Writer extends CC_Main
 {
 	/**
-	 * @const VERSION app version number
-	 */
-	const VERSION = '1.0.0-alpha';
-
-	/**
-	 * singleton instance for this class
-	 * @var $singleton instanceof Tooltips
-	 */
-	static protected $singleton;
-
-	/**
 	 * public function __construct
 	 *
-	 * checks for requirements, runs the splash screen,
-	 * loads the theme and configuration files, starts up
-	 * the main project interface or the wizard
+	 * description
 	 *
-	 * @return void
+	 * @param type $name about
+	 * @return type about
 	 */
 	public function __construct()
 	{
-
-		if(!is_null(self::$singleton))
-		{
-			throw new Exception(CC::i18n(
-			'%1$s is a singleton class - use %1$s::instance() to retrieve the current object',
-			'CC_Writer'));
-		}
-		self::$singleton = $this;
-
-		$splash = new CC_Splash(5, 'Writer');
-		$splash->setImage(DIR . 'programs' . DS . 'writer' . DS . 'images' . DS . 'splash.png');
-		$splash->setCopyright('Copyright (c) E. M. Smith 2006');
-		$splash->setVersion('version ' . self::VERSION);
-		$splash->setLicense('Released under GPL License');
-		$splash->show_all();
-
-		$splash->update('Checking Requirements');
-
-		$splash->update('Initializing Messages');
-		set_error_handler(array('CC_Message', 'error'));
-		set_exception_handler(array('CC_Message', 'exception'));
-
-		$splash->update('Initializing Settings');
-		$config = new CC_Config('Writer');
-
-		$splash->update('Loading Project');
 		parent::__construct();
-		$splash->parent($this);
-
-		CC::setDefaultIcon('cc-writer-icon');
-
-
-//self::$project = new ProjectFile($file);
-
-		$this->set_title('Project Title goes here');
-
-
-		$this->connect_simple('destroy', array('Gtk', 'main_quit'));
 		$this->show_all();
-
-		$splash->update('Loaded');
-		$splash->destroy();
-		unset($splash, $window);
-		return;
 	}
 
-	//----------------------------------------------------------------
-	//             Building Items
-	//----------------------------------------------------------------
-
-	/**
-	 * protected function buildActions
-	 *
-	 * creates generic window actions
-	 *
-	 * @todo add additional generic actions
-	 * @return void
-	 */
-	protected function buildActions()
+	public function on_about()
 	{
-		parent::buildActions();
-		$actions = CC_Actions::instance();
-
-		$actions->add_actions('file', array(
-		array(
-			'type' => 'action',
-			'name' => 'new',
-			'label' => '_New...',
-			'short-label' => '_New',
-			'tooltip' => 'Create new project',
-			'accel' => '<Ctrl>n',
-			'callback' => array($this, 'onNew'),
-			'image' => 'gtk-new',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'open',
-			'label' => '_Open...',
-			'short-label' => '_Open',
-			'tooltip' => 'Open new project',
-			'accel' => '<Ctrl>o',
-			'callback' => array($this, 'onOpen'),
-			'image' => 'gtk-open',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'close',
-			'label' => '_Close',
-			'short-label' => '_Close',
-			'tooltip' => 'Close current project',
-			'callback' => array($this, 'onClose'),
-			'image' => 'gtk-close',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'delete',
-			'label' => '_Delete',
-			'short-label' => '_Delete',
-			'tooltip' => 'Delete current project',
-			'callback' => array($this, 'onDelete'),
-			'image' => 'gtk-delete',
-			'accel' => 'Delete',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'save',
-			'label' => '_Save',
-			'short-label' => '_Save',
-			'tooltip' => 'Save current project',
-			'callback' => array($this, 'onSave'),
-			'image' => 'gtk-save',
-			'accel' => '<Ctrl>s',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'saveas',
-			'label' => 'Save _As...',
-			'short-label' => 'Save _As',
-			'tooltip' => 'Save current project',
-			'callback' => array($this, 'onSaveAs'),
-			'image' => 'gtk-save-as',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'revert',
-			'label' => 'Re_vert',
-			'short-label' => 'Re_vert',
-			'tooltip' => 'Rever current project to last save',
-			'callback' => array($this, 'onRevert'),
-			'image' => 'cc-revert',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'print',
-			'label' => '_Print',
-			'short-label' => '_Print',
-			'tooltip' => 'Print current project',
-			'callback' => array($this, 'onPrint'),
-			'image' => 'gtk-print',
-			'accel' => '<Ctrl>p',
-			),
-		));
-
-		$actions->add_actions('manage', array(
-		array(
-			'type' => 'action',
-			'name' => 'wizard',
-			'label' => '_Wizard...',
-			'short-label' => '_Wizard',
-			'tooltip' => 'Create project using wizard',
-			'callback' => array($this, 'onWizard'),
-			'image' => 'cc-wizard',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'import',
-			'label' => '_Import...',
-			'short-label' => '_Import',
-			'tooltip' => 'Import project from another format',
-			'callback' => array($this, 'onImport'),
-			'image' => 'gtk-convert',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'export',
-			'label' => '_Export...',
-			'short-label' => '_Export',
-			'tooltip' => 'Export project to another format',
-			'callback' => array($this, 'onExport'),
-			'image' => 'cc-save-all',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'properties',
-			'label' => '_Properties...',
-			'short-label' => '_Properties',
-			'tooltip' => 'View and edit project properties',
-			'callback' => array($this, 'onProperties'),
-			'image' => 'gtk-execute',
-			),
-		));
-
-		$actions->add_actions('tools', array(
-		array(
-			'type' => 'action',
-			'name' => 'characters',
-			'label' => '_Characters...',
-			'short-label' => '_Characters',
-			'tooltip' => 'Characters management',
-			'callback' => array($this, 'onCharacters'),
-			'image' => 'cc-users',
-			'accel' => 'F2',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'places',
-			'label' => '_Places...',
-			'short-label' => '_Places',
-			'tooltip' => 'Places management',
-			'callback' => array($this, 'onPlaces'),
-			'image' => 'cc-folder-home',
-			'accel' => 'F3',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'notes',
-			'label' => '_Notes...',
-			'short-label' => '_Notes',
-			'tooltip' => 'Project notes',
-			'callback' => array($this, 'onNotes'),
-			'image' => 'cc-notes',
-			'accel' => 'F4',
-			),
-		array(
-			'type' => 'action',
-			'name' => 'preferences',
-			'label' => '_Preferences...',
-			'short-label' => '_Preferences',
-			'tooltip' => 'View and edit writer preferences',
-			'callback' => array($this, 'onPreferences'),
-			'image' => 'gtk-preferences',
-			),
-		));
-		return;
 	}
-
-	/**
-	 * protected function buildMenu
-	 *
-	 * build a default menubar
-	 * file quit, view options
-	 *
-	 * @todo finish menu creation
-	 * @return void
-	 */
-	protected function buildMenu()
+	public function on_help()
 	{
-		$this->menu = $menu = is_null($this->menu) ? new GtkMenuBar() : $this->menu;
-		$actions = CC_Actions::instance();
-		$config = CC_Config::instance();
-
-		$item = new GtkMenuItem(CC::i18n('_File'));
-		$menu->add($item);
-		$submenu = new GtkMenu();
-		$item->set_submenu($submenu);
-
-		$submenu->append($actions->create_menu_item('file', 'new'));
-		$submenu->append($actions->create_menu_item('file', 'open'));
-		$submenu->append($actions->create_menu_item('file', 'close'));
-		$submenu->append($actions->create_menu_item('file', 'delete'));
-		$submenu->append(new GtkSeparatorMenuItem());
-		$submenu->append($actions->create_menu_item('file', 'save'));
-		$submenu->append($actions->create_menu_item('file', 'saveas'));
-		$submenu->append($actions->create_menu_item('file', 'revert'));
-		$submenu->append($actions->create_menu_item('file', 'print'));
-		$submenu->append(new GtkSeparatorMenuItem());
-
-		$item = new GtkMenuItem(CC::i18n('Recent'));
-		$submenu->append($item);
-		$subitem = new GtkMenu();
-		$item->set_submenu($subitem);
-
-		$list = $config->project_recent ? $config->project_recent : array();
-		foreach($list as $id => $file)
-		{
-			if(!file_exists($file))
-			{
-				unset($list[$id]);
-				continue;
-			}
-			$child = new GtkMenuItem(basename($file));
-			$subitem->append($child);
-			$tooltips->set_tip($child, $file);
-			$child->connect_simple('activate', array($this, 'onOpen'), $file);
-		}
-
-		$submenu->append(new GtkSeparatorMenuItem());
-		$submenu->append($actions->create_menu_item('file', 'quit'));
-
-		$item = new GtkMenuItem(CC::i18n('_Manage'));
-		$menu->add($item);
-		$submenu = new GtkMenu();
-		$item->set_submenu($submenu);
-
-		$submenu->append($actions->create_menu_item('manage', 'wizard'));
-		$submenu->append($actions->create_menu_item('manage', 'import'));
-		$submenu->append($actions->create_menu_item('manage', 'export'));
-		$submenu->append(new GtkSeparatorMenuItem());
-		$submenu->append($actions->create_menu_item('manage', 'properties'));
-
-		$item = new GtkMenuItem(CC::i18n('_Tools'));
-		$menu->add($item);
-		$submenu = new GtkMenu();
-		$item->set_submenu($submenu);
-
-		$submenu->append($actions->create_menu_item('toolbar', 'toggle'));
-		$submenu->append(new GtkSeparatorMenuItem());
-		$submenu->append($actions->create_menu_item('tools', 'characters'));
-		$submenu->append($actions->create_menu_item('tools', 'places'));
-		$submenu->append($actions->create_menu_item('tools', 'notes'));
-		$submenu->append(new GtkSeparatorMenuItem());
-		$submenu->append($actions->create_menu_item('tools', 'preferences'));
-		$submenu->append($actions->create_menu_item('toolbar', 'customize'));
-
-		$item = new GtkMenuItem(CC::i18n('_Help'));
-		$menu->add($item);
-		$submenu = new GtkMenu();
-		$item->set_submenu($submenu);
-
-		$submenu->append($actions->create_menu_item('help', 'help'));
-		$submenu->append($actions->create_menu_item('help', 'website'));
-
-		$submenu->append(new GtkSeparatorMenuItem());
-
-		$submenu->append($actions->create_menu_item('help', 'about'));
-
-		unset($this, $menu, $actions, $item, $submenu, $list, $id, $file, $child);
-		return;
 	}
-
-	/**
-	 * protected function buildToolbar
-	 *
-	 * set up default and possible actions, and set name for toolbar
-	 *
-	 * @return void
-	 */
-	protected function buildToolbar()
-	{
-		$this->toolbar->default = array('file:new', 'file:delete', 'file:save',
-			'separator', 'manage:import', 'manage:export', 'separator',
-			'file:print', 'manage:properties');
-
-		$this->toolbar->options = array('file:new', 'file:open',
-			'file:close','file:delete', 'file:save', 'file:saveas',
-			'file:revert', 'file:print', 'file:quit','manage:wizard',
-			'manage:import', 'manage:export', 'manage:properties',
-			'tools:characters', 'tools:places', 'tools:notes', 'tools:preferences',
-			'help:help', 'help:website', 'help:about');
-
-		$this->toolbar->buildToolbar();
-
-		return;
-	}
-
-	//----------------------------------------------------------------
-	//             Callbacks
-	//----------------------------------------------------------------
-
-	/**
-	 * public function onDeleteEvent
-	 *
-	 * callback for delete-event, saves window size and position
-	 *
-	 * @return void
-	 */
-	public function onDeleteEvent()
-	{
-		$config = CC_Config::instance();
-		//$config->last_open_file = CC_Project::instance()->getFilename();
-		unset($config);
-		parent::onDeleteEvent();
-		return;
-	}
-
-	/**
-	 * static public function instance
-	 *
-	 * this is how items can access the main window instance
-	 *
-	 * @return object instanceof CC_Writer
-	 */
-	static public function instance()
-	{
-		if(is_null(self::$singleton))
-		{
-			self::$singleton = new CC_Writer();
-		}
-		return self::$singleton;
-	}
-
-	/**
-	 * public function __clone()
-	 *
-	 * disable cloning of a singleton
-	 *
-	 * @return void
-	 */
-	public function __clone()
-	{
-		throw new Exception(CC::i18n('Cannot clone singleton object %s', 'CC_Writer'));
-		return;
-	}
 }
 ?>
\ No newline at end of file