adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_compiler.cc,1.9


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_compiler.cc,1.9,1.10 dlg_compiler.h,1.5,1.6 dlg_module.cc,1.5,1.6 dlg_module.h,1.4,1.5 dlg_node.h,1.3,1.4 dlg_node_gfx.h,1.2,1.3 dlg_types.h,1.3,1.4 gui_circle.h,1.3,1.4 gui_circle_events.cc,1.2,1.3 gui_code.cc,1.2,1.3 gui_code.h,1.2,1.3 gui_dlgedit.cc,1.4,1.5 gui_dlgedit.h,1.4,1.5 gui_dlgedit_events.cc,1.2,1.3 gui_dlgedit_events.h,1.2,1.3 gui_graph.cc,1.3,1.4 gui_graph.h,1.3,1.4 gui_list.cc,1.2,1.3 gui_list_events.cc,1.2,1.3 gui_messages.cc,1.2,1.3 gui_settings.cc,1.4,1.5 gui_settings.h,1.2,1.3 main.cc,1.57,1.58
Date: Sat, 12 Oct 2002 14:51:36 -0400

Update of /cvsroot/adonthell/adonthell/src/tools/dlgedit
In directory subversions:/tmp/cvs-serv6058/src/tools/dlgedit

Modified Files:
        dlg_compiler.cc dlg_compiler.h dlg_module.cc dlg_module.h 
        dlg_node.h dlg_node_gfx.h dlg_types.h gui_circle.h 
        gui_circle_events.cc gui_code.cc gui_code.h gui_dlgedit.cc 
        gui_dlgedit.h gui_dlgedit_events.cc gui_dlgedit_events.h 
        gui_graph.cc gui_graph.h gui_list.cc gui_list_events.cc 
        gui_messages.cc gui_settings.cc gui_settings.h main.cc 
Log Message:
ADDED dlgedit API doc
ADDED proper 'Save' option to dlgedit (old 'Save' renamed to 'Save As')
CLEANUP of dialogue name code
CLEANUP of dlgedit '#include's


Index: dlg_compiler.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_compiler.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** dlg_compiler.cc     9 Aug 2002 20:01:26 -0000       1.9
--- dlg_compiler.cc     12 Oct 2002 18:51:33 -0000      1.10
***************
*** 82,89 ****
      
      // try to open the file
!     std::string fname = dialogue->name ();
  
!     // remove the serial number from the name
!     unsigned int pos = fname.rfind ("-");
      if (pos != fname.npos) fname.erase (pos);
  
--- 82,89 ----
      
      // try to open the file
!     std::string fname = dialogue->fullName ();
  
!     // remove the file extension
!     unsigned int pos = fname.rfind (FILE_EXT);
      if (pos != fname.npos) fname.erase (pos);
  

Index: dlg_compiler.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_compiler.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** dlg_compiler.h      1 Jul 2002 13:53:59 -0000       1.5
--- dlg_compiler.h      12 Oct 2002 18:51:33 -0000      1.6
***************
*** 23,28 ****
  #define DLG_COMPILER_H
  
- #include <vector>
- #include <fstream>
  #include "dlg_module.h"
  #include "dlg_circle.h"
--- 23,26 ----

Index: dlg_module.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** dlg_module.cc       1 Jul 2002 13:53:59 -0000       1.5
--- dlg_module.cc       12 Oct 2002 18:51:33 -0000      1.6
***************
*** 27,38 ****
  
  // ctor
! DlgModule::DlgModule (std::string n, std::string d)
  {
-     // get the serial number from the name
-     unsigned int pos = n.rfind ("-");
-     if (pos != n.npos) serial_ = n.substr (pos);
-     
      description_ = d;
!     setName (n);
      init ();
  }
--- 27,37 ----
  
  // ctor
! DlgModule::DlgModule (std::string p, std::string n, std::string s, 
std::string d)
  {
      description_ = d;
!     serial_ = s;
!     path_ = p + "/";
!     name_ = n;
!     
      init ();
  }
***************
*** 48,65 ****
  }
  
- // assign a name to the module
- void DlgModule::setName (const std::string &filename)
- {
-     name_ = filename;
-     
-     // remove file extension
-     unsigned int pos = name_.rfind (".adlg");
-     if (pos != name_.npos) name_.erase (pos, 5);
-     
-     // set serial number
-     pos = name_.rfind (serial_);
-     if (pos == name_.npos) name_ += serial_;
- }
- 
  // select a given node
  bool DlgModule::selectNode (DlgNode *node)
--- 47,50 ----
***************
*** 219,222 ****
--- 204,208 ----
                  break;                
              }
+ 
              case LOAD_NOTE:
              {
***************
*** 294,300 ****
  
  // save dialogue to file
! bool DlgModule::save (std::string &file)
  {
!     std::ofstream out (file.c_str ());
      int index = 0;
      
--- 280,291 ----
  
  // save dialogue to file
! bool DlgModule::save (std::string &path, std::string &name)
  {
!     // update path and name
!     path_ = path + "/";
!     name_ = name;
!     
!     // open file
!     std::ofstream out (fullName ().c_str ());
      int index = 0;
      
***************
*** 309,312 ****
--- 300,306 ----
          << "Note §" << description_ << "§\n\n";
  
+     // Node ID
+     out << "Id " << nid_ << "\n";
+     
      // Save settings and stuff
      if (entry_.project () != "")
***************
*** 340,346 ****
      // mark dialogue as unchanged
      changed_ = false;
-     
-     // update filename    
-     setName (file);
      
      return true;    
--- 334,337 ----

Index: dlg_module.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** dlg_module.h        1 Jul 2002 13:53:59 -0000       1.4
--- dlg_module.h        12 Oct 2002 18:51:33 -0000      1.5
***************
*** 23,28 ****
  #define DLG_MODULE_H
  
- #include <vector>
- #include <string>
  #include "dlg_node.h"
  #include "dlg_module_entry.h"
--- 23,26 ----
***************
*** 37,41 ****
  {
  public:
!     DlgModule (std::string n, std::string d);
      
      /**
--- 35,46 ----
  {
  public:
!     /**
!      * Create a new, empty dialogue module.
!      * @param p The full path to the file containing the module.
!      * @param n The actual name without file extension.
!      * @param s Unique id of the module.
!      * @param d Description of the module.
!      */
!     DlgModule (std::string p, std::string n, std::string s, std::string d);
      
      /**
***************
*** 118,133 ****
       */
      bool load ();
      /**
       * Save the Dialogue to a file
!      * @param file full path and filename of the dialogue
!      * @return <b>true</b> if saving was successful, <b>false</b>
!      *         otherwise.
       */
!     bool save (std::string &file);
      
      /**
!      * Save the Dialogue to a file
       */
!     void save (std::ofstream &file)          { }
      
      /**
--- 123,141 ----
       */
      bool load ();
+     
      /**
       * Save the Dialogue to a file
!      * @param path full path of the dialogue.
!      * @param name file name without extension.
!      * @return <b>true</b> if saving was successful, <b>false</b> otherwise.
       */
!     bool save (std::string &path, std::string &name);
      
      /**
!      * Save the Dialogue to a file. Not implemented - use 
!      * save (std::string, std::string) instead!
!      * @param file an opened file.
       */
!     void save (std::ofstream &file)     { }
      
      /**
***************
*** 148,156 ****
       */
      std::string &name ()                { return name_; }
      /**
!      * Set the name of this dialogue.
!      * @param the filename of the file the dialogue was loaded from.
       */
!     void setName (const std::string &filename);
      
      /**
--- 156,173 ----
       */
      std::string &name ()                { return name_; }
+ 
      /**
!      * Get the name and id of this dialogue. To be used for window
!      * captions and window menu.
!      * @return string composed of name and unique id.
       */
!     std::string shortName ()            { return name_ + serial_; }
! 
!     /**
!      * Get the full path and filename of this dialogue. To be used when
!      * saving the dialogue.
!      * @return string composed of path, filename and file extension.
!      */
!     std::string fullName ()             { return path_ + name_ + FILE_EXT; }
      
      /**
***************
*** 179,186 ****
      DlgPoint offset_;           // The current offset in the graph view
      bool changed_;              // Whether there were changes since saving
      
      std::string name_;          // Short (file-) name of the dialogue 
!     std::string description_;   // Description of the dialogue
      std::string serial_;        // Unique number of the dialogue
      
      DlgModuleEntry entry_;      // further content of the dialogue
--- 196,205 ----
      DlgPoint offset_;           // The current offset in the graph view
      bool changed_;              // Whether there were changes since saving
+     int nid_;                   // Id to use for the next new node
      
      std::string name_;          // Short (file-) name of the dialogue 
!     std::string path_;          // Path of the dialogue
      std::string serial_;        // Unique number of the dialogue
+     std::string description_;   // Description of the dialogue
      
      DlgModuleEntry entry_;      // further content of the dialogue

Index: dlg_node.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_node.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** dlg_node.h  1 Jul 2002 13:53:59 -0000       1.3
--- dlg_node.h  12 Oct 2002 18:51:33 -0000      1.4
***************
*** 27,31 ****
  #include <stdio.h>
  #include <fstream>
- #include "dlg_types.h"
  #include "dlg_node_gfx.h"
  
--- 27,30 ----
***************
*** 140,150 ****
      node_type &type ()      { return type_; }
      
      void setIndex (int i)   { index_ = i; }
      int index ()            { return index_; }
          
  protected:
      node_type type_;                    // type of the node
      int index_;                         // position of node in file when 
saving
!         
      std::list<DlgNode*> prev_;          // list of node's parents
      std::list<DlgNode*> next_;          // list of node's children
--- 139,176 ----
      node_type &type ()      { return type_; }
      
+     /**
+      * Set the node's position in the dlg_module::nodes array.
+      * @param i position of the node.
+      */
      void setIndex (int i)   { index_ = i; }
+ 
+     /**
+      * Get the node's position in the dlg_module::nodes array.
+      * @return position of the node.
+      */
      int index ()            { return index_; }
+     
+     /**
+      * Return the node's unique id. This is given when the node is
+      * created and will never change from then on. It can be used
+      * to correctly identify nodes of subdialogues and the like.
+      * @return unique id of the node.
+      */
+     int node_id ()          { return nid_; }
+     
+     /**
+      * Returns id of the module this node belongs to. It allows us 
+      * to tell nodes of different modules apart. Together with the
+      * node id, this gives each node a unique id.
+      * @return module id.
+      */
+     std::string module_id (){ return mid_; }
          
  protected:
      node_type type_;                    // type of the node
      int index_;                         // position of node in file when 
saving
!     int nid_;                           // unique node id
!     std::string mid_;                   // unique module id
!     
      std::list<DlgNode*> prev_;          // list of node's parents
      std::list<DlgNode*> next_;          // list of node's children

Index: dlg_node_gfx.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_node_gfx.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** dlg_node_gfx.h      7 Apr 2002 09:51:28 -0000       1.2
--- dlg_node_gfx.h      12 Oct 2002 18:51:33 -0000      1.3
***************
*** 23,27 ****
  #define DLG_NODE_GFX_H
  
- #include <gdk/gdktypes.h>
  #include "dlg_rect.h"
  #include "dlg_types.h"
--- 23,26 ----

Index: dlg_types.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_types.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** dlg_types.h 25 Jun 2002 16:25:52 -0000      1.3
--- dlg_types.h 12 Oct 2002 18:51:33 -0000      1.4
***************
*** 78,94 ****
  };
  
  enum menu_item
  {
      SAVE            = 0,
!     CLOSE           = 1,
!     SETTINGS        = 2,
!     FUNCTIONS       = 3,
!     COMPILE         = 4,
!     PREVIEW         = 5,
!     RUN             = 6,
!     MAX_ITEM        = 7
  };
  
  #define LOAD    1
  #define SAVE    2
  
--- 78,105 ----
  };
  
+ /**
+  * Talking names for the different file menu items.
+  */
  enum menu_item
  {
      SAVE            = 0,
!     SAVE_AS         = 1,
!     CLOSE           = 2,
!     SETTINGS        = 3,
!     FUNCTIONS       = 4,
!     COMPILE         = 5,
!     PREVIEW         = 6,
!     RUN             = 7,
!     MAX_ITEM        = 8
  };
  
+ /**
+  * Load node of file selction box.
+  */
  #define LOAD    1
+ 
+ /**
+  * Save mode of file selction box.
+  */
  #define SAVE    2
  
***************
*** 127,133 ****
  
  /**
!  * The size of a DlgCircle
   */
  #define CIRCLE_DIAMETER 20
!     
  #endif // DLG_TYPES_H
--- 138,149 ----
  
  /**
!  * The size of a DlgCircle.
   */
  #define CIRCLE_DIAMETER 20
! 
! /**
!  * File extension of dialogue source files.
!  */
! #define FILE_EXT ".adlg"
! 
  #endif // DLG_TYPES_H

Index: gui_circle.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_circle.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gui_circle.h        25 Jun 2002 16:25:52 -0000      1.3
--- gui_circle.h        12 Oct 2002 18:51:33 -0000      1.4
***************
*** 23,27 ****
  #define GUI_CIRCLE_H
  
- #include <string>
  #include "dlg_circle_entry.h"
  #include "dlg_module_entry.h"
--- 23,26 ----

Index: gui_circle_events.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_circle_events.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_circle_events.cc        7 Apr 2002 09:51:28 -0000       1.2
--- gui_circle_events.cc        12 Oct 2002 18:51:33 -0000      1.3
***************
*** 23,27 ****
  #include "gui_circle_events.h"
  #include "gui_circle.h"
- #include "dlg_types.h"
  
  // When switching pages of the notebook, give Focus to first widget on the 
new page
--- 23,26 ----

Index: gui_code.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_code.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_code.cc 7 Apr 2002 09:51:28 -0000       1.2
--- gui_code.cc 12 Oct 2002 18:51:33 -0000      1.3
***************
*** 163,167 ****
  
  // display the dialog
! void GuiCode::display (DlgModuleEntry *e, std::string &name)
  {
      if (entry != e)
--- 163,167 ----
  
  // display the dialog
! void GuiCode::display (DlgModuleEntry *e, const std::string &name)
  {
      if (entry != e)
***************
*** 178,182 ****
      // set the title
      gchar *title = g_strjoin (NULL, "Custom Python Code - [", 
!         g_basename (name.c_str ()), "]", NULL);
      gtk_window_set_title (GTK_WINDOW (window), title);
  
--- 178,182 ----
      // set the title
      gchar *title = g_strjoin (NULL, "Custom Python Code - [", 
!         name.c_str (), "]", NULL);
      gtk_window_set_title (GTK_WINDOW (window), title);
  

Index: gui_code.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_code.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_code.h  7 Apr 2002 09:51:28 -0000       1.2
--- gui_code.h  12 Oct 2002 18:51:33 -0000      1.3
***************
*** 33,37 ****
--- 33,44 ----
  {
  public:
+     /**
+      * Create empty Python Code Dialog.
+      */
      GuiCode ();
+ 
+     /**
+      * Cleanup.
+      */
      ~GuiCode ();
      
***************
*** 46,50 ****
       * @param name name of the dialogue whose code is being edited.
       */
!     void display (DlgModuleEntry *entry, std::string &name);
      
      /**
--- 53,57 ----
       * @param name name of the dialogue whose code is being edited.
       */
!     void display (DlgModuleEntry *entry, const std::string &name);
      
      /**

Index: gui_dlgedit.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_dlgedit.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** gui_dlgedit.cc      25 Jun 2002 16:25:52 -0000      1.4
--- gui_dlgedit.cc      12 Oct 2002 18:51:33 -0000      1.5
***************
*** 134,138 ****
  
      // Load
!     menuitem = gtk_menu_item_new_with_label ("Open");
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_o, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
--- 134,138 ----
  
      // Load
!     menuitem = gtk_menu_item_new_with_label ("Open ...");
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_o, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
***************
*** 153,156 ****
--- 153,167 ----
      gtk_widget_show (menuitem);
      menuItem[SAVE] = menuitem;
+      
+     // Save As
+     menuitem = gtk_menu_item_new_with_label ("Save As ...");
+     gtk_container_add (GTK_CONTAINER (submenu), menuitem);
+     gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_a, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
+     gtk_object_set_data (GTK_OBJECT (menuitem), "help-id", GINT_TO_POINTER 
(4));
+     gtk_signal_connect (GTK_OBJECT (menuitem), "enter-notify-event", 
GTK_SIGNAL_FUNC (on_display_help), message);
+     gtk_signal_connect (GTK_OBJECT (menuitem), "leave-notify-event", 
GTK_SIGNAL_FUNC (on_clear_help), message);
+     gtk_signal_connect (GTK_OBJECT (menuitem), "activate", GTK_SIGNAL_FUNC 
(on_file_save_as_activate), (gpointer) this);
+     gtk_widget_show (menuitem);
+     menuItem[SAVE_AS] = menuitem;
      
      // Close
***************
*** 158,162 ****
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_w, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
!     gtk_object_set_data (GTK_OBJECT (menuitem), "help-id", GINT_TO_POINTER 
(4));
      gtk_signal_connect (GTK_OBJECT (menuitem), "enter-notify-event", 
GTK_SIGNAL_FUNC (on_display_help), message);
      gtk_signal_connect (GTK_OBJECT (menuitem), "leave-notify-event", 
GTK_SIGNAL_FUNC (on_clear_help), message);
--- 169,173 ----
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_w, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
!     gtk_object_set_data (GTK_OBJECT (menuitem), "help-id", GINT_TO_POINTER 
(5));
      gtk_signal_connect (GTK_OBJECT (menuitem), "enter-notify-event", 
GTK_SIGNAL_FUNC (on_display_help), message);
      gtk_signal_connect (GTK_OBJECT (menuitem), "leave-notify-event", 
GTK_SIGNAL_FUNC (on_clear_help), message);
***************
*** 175,179 ****
      gtk_menu_append (GTK_MENU (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_q, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
!     gtk_object_set_data (GTK_OBJECT (menuitem), "help-id", GINT_TO_POINTER 
(5));
      gtk_signal_connect (GTK_OBJECT (menuitem), "enter-notify-event", 
GTK_SIGNAL_FUNC (on_display_help), message);
      gtk_signal_connect (GTK_OBJECT (menuitem), "leave-notify-event", 
GTK_SIGNAL_FUNC (on_clear_help), message);
--- 186,190 ----
      gtk_menu_append (GTK_MENU (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_q, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
!     gtk_object_set_data (GTK_OBJECT (menuitem), "help-id", GINT_TO_POINTER 
(6));
      gtk_signal_connect (GTK_OBJECT (menuitem), "enter-notify-event", 
GTK_SIGNAL_FUNC (on_display_help), message);
      gtk_signal_connect (GTK_OBJECT (menuitem), "leave-notify-event", 
GTK_SIGNAL_FUNC (on_clear_help), message);
***************
*** 191,195 ****
      
      // Settings
!     menuitem = gtk_menu_item_new_with_label ("Settings");
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_t, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
--- 202,206 ----
      
      // Settings
!     menuitem = gtk_menu_item_new_with_label ("Settings ...");
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_t, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
***************
*** 202,206 ****
  
      // Custom Functions
!     menuitem = gtk_menu_item_new_with_label ("Python Code");
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_p, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
--- 213,217 ----
  
      // Custom Functions
!     menuitem = gtk_menu_item_new_with_label ("Python Code ...");
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_p, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
***************
*** 231,235 ****
      // Preview i18n
  #ifdef ENABLE_NLS 
!     menuitem = gtk_menu_item_new_with_label ("Preview Localization");
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_l, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
--- 242,246 ----
      // Preview i18n
  #ifdef ENABLE_NLS 
!     menuitem = gtk_menu_item_new_with_label ("Preview Localization ...");
      gtk_container_add (GTK_CONTAINER (submenu), menuitem);
      gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_l, 
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
***************
*** 350,363 ****
  void GuiDlgedit::newDialogue ()
  {
-     // the name of the dialogue
-     gchar *name = g_strdup_printf ("%s/untitled-%i", directory_.c_str (), 
++number);
-             
      // the new dialogue
!     DlgModule *module = initDialogue (name);
  
      // Display the dialogue
      showDialogue (module);
- 
-     g_free (name);
  }
  
--- 361,369 ----
  void GuiDlgedit::newDialogue ()
  {
      // the new dialogue
!     DlgModule *module = initDialogue ("untitled");
  
      // Display the dialogue
      showDialogue (module);
  }
  
***************
*** 372,388 ****
      }
      
-     // get the name to use for the dialogue
-     file += g_strdup_printf ("-%i", ++number);
- 
      // remember the current directory for later use
      directory_ = g_dirname (file.c_str ());
      
      // the new dialogue
!     DlgModule *module = initDialogue (file);
  
      // try to load from file
      if (!module->load ())
      {
!         message->display (-2, g_basename (filename ().c_str ()));
          closeDialogue ();
      }
--- 378,398 ----
      }
      
      // remember the current directory for later use
      directory_ = g_dirname (file.c_str ());
      
+     // get the name to use for the dialogue
+     std::string filename = g_basename (file.c_str ());
+     
+     // remove file extension
+     unsigned int pos = filename.rfind (FILE_EXT);
+     if (pos != filename.npos) filename.erase (pos, -1);
+ 
      // the new dialogue
!     DlgModule *module = initDialogue (filename);
  
      // try to load from file
      if (!module->load ())
      {
!         message->display (-2, filename.c_str ());
          closeDialogue ();
      }
***************
*** 405,414 ****
      directory_ = g_dirname (file.c_str ());
      
!     // append the ".adlg" extension if necessary
!     if (file.rfind (".adlg") == file.npos) file += ".adlg";
  
      // try to save file
!     if (!module->save (file)) 
!         message->display (-4, g_basename (file.c_str ()));
      else
      {
--- 415,428 ----
      directory_ = g_dirname (file.c_str ());
      
!     // get the filename
!     std::string filename = g_basename (file.c_str ());
!     
!     // remove file extension
!     unsigned int pos = filename.rfind (FILE_EXT);
!     if (pos != filename.npos) filename.erase (pos, -1);
  
      // try to save file
!     if (!module->save (directory_, filename)) 
!         message->display (-4, filename.c_str ());
      else
      {
***************
*** 459,467 ****
      // update the custom code entry if neccessary
      if (GuiCode::dialog != NULL)
!         GuiCode::dialog->display (module->entry (), module->name ());
      
      // update the settings if neccessary
      if (GuiSettings::dialog != NULL)
!         GuiSettings::dialog->display (module->entry (), module->name ());
  
      // update the window title
--- 473,481 ----
      // update the custom code entry if neccessary
      if (GuiCode::dialog != NULL)
!         GuiCode::dialog->display (module->entry (), module->shortName ());
      
      // update the settings if neccessary
      if (GuiSettings::dialog != NULL)
!         GuiSettings::dialog->display (module->entry (), module->shortName ());
  
      // update the window title
***************
*** 499,503 ****
      
      // otherwise just show it
!     GuiSettings::dialog->display (module->entry (), module->name ());
  }
  
--- 513,517 ----
      
      // otherwise just show it
!     GuiSettings::dialog->display (module->entry (), module->shortName ());
  }
  
***************
*** 513,517 ****
      
      // otherwise just show it
!     GuiCode::dialog->display (module->entry (), module->name ());
  }
  
--- 527,531 ----
      
      // otherwise just show it
!     GuiCode::dialog->display (module->entry (), module->shortName ());
  }
  
***************
*** 646,651 ****
  DlgModule *GuiDlgedit::initDialogue (std::string name)
  {
      // the new dialogue
!     DlgModule *dlg = new DlgModule (name, "New Dialogue");
  
      // insert into the list of open dialogues
--- 660,668 ----
  DlgModule *GuiDlgedit::initDialogue (std::string name)
  {
+     // serial number
+     std::string serial = g_strdup_printf ("-%i", ++number);
+ 
      // the new dialogue
!     DlgModule *dlg = new DlgModule (directory_, name, serial, "New Dialogue");
  
      // insert into the list of open dialogues
***************
*** 657,660 ****
--- 674,678 ----
      // activate all dialogue related menu-items
      gtk_widget_set_sensitive (menuItem[SAVE], TRUE);
+     gtk_widget_set_sensitive (menuItem[SAVE_AS], TRUE);
      gtk_widget_set_sensitive (menuItem[CLOSE], TRUE);
      gtk_widget_set_sensitive (menuItem[SETTINGS], TRUE);
***************
*** 676,680 ****
      if (module != NULL)
          title = g_strjoin (NULL, title, " - [", 
!                 g_basename (module->name().c_str ()), "]", NULL);
  
      gtk_window_set_title (GTK_WINDOW (wnd), title);
--- 694,698 ----
      if (module != NULL)
          title = g_strjoin (NULL, title, " - [", 
!                 module->shortName ().c_str (), "]", NULL);
  
      gtk_window_set_title (GTK_WINDOW (wnd), title);
***************
*** 694,703 ****
      GtkAccelGroup *accel_group = gtk_accel_group_get_default ();
      GtkWidget *menuitem;
-     gchar *name;
      
      for (i = dialogues_.begin (); i != dialogues_.end (); i++, position++)
      {
!         name = (char*) (*i)->name().c_str ();
!         menuitem = gtk_menu_item_new_with_label (g_basename (name));
          gtk_container_add (GTK_CONTAINER (windowMenu), menuitem);
          gtk_signal_connect (GTK_OBJECT (menuitem), "activate", 
GTK_SIGNAL_FUNC (on_window_activate), (gpointer) *i);
--- 712,719 ----
      GtkAccelGroup *accel_group = gtk_accel_group_get_default ();
      GtkWidget *menuitem;
      
      for (i = dialogues_.begin (); i != dialogues_.end (); i++, position++)
      {
!         menuitem = gtk_menu_item_new_with_label ((*i)->shortName ().c_str ());
          gtk_container_add (GTK_CONTAINER (windowMenu), menuitem);
          gtk_signal_connect (GTK_OBJECT (menuitem), "activate", 
GTK_SIGNAL_FUNC (on_window_activate), (gpointer) *i);
***************
*** 799,802 ****
--- 815,819 ----
      // make the various menu-items insensitive
      gtk_widget_set_sensitive (menuItem[SAVE], FALSE);
+     gtk_widget_set_sensitive (menuItem[SAVE_AS], FALSE);
      gtk_widget_set_sensitive (menuItem[CLOSE], FALSE);
      gtk_widget_set_sensitive (menuItem[SETTINGS], FALSE);
***************
*** 888,904 ****
  }
  
! // get the full path/name of a dialogue
  std::string GuiDlgedit::filename ()
  {
      DlgModule *module = graph_->dialogue ();
      
!     // if there is no module, return the current working directory
!     if (module == NULL) return directory_;
!     std::string file = module->name ();
!     
!     // remove the serial number from the name
!     unsigned int pos = file.rfind ("-");
!     if (pos != file.npos) file.erase (pos);
!     
!     return file;
  }
--- 905,913 ----
  }
  
! // get the full path/name/extension of a dialogue
  std::string GuiDlgedit::filename ()
  {
      DlgModule *module = graph_->dialogue ();
      
!     return module->fullName ();
  }

Index: gui_dlgedit.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_dlgedit.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** gui_dlgedit.h       25 Jun 2002 16:25:52 -0000      1.4
--- gui_dlgedit.h       12 Oct 2002 18:51:33 -0000      1.5
***************
*** 23,29 ****
  #define GUI_DLGEDIT_H
  
- #include <vector>
- #include <string>
- #include <gtk/gtkstyle.h>
  #include "gui_messages.h"
  #include "gui_graph.h"
--- 23,26 ----

Index: gui_dlgedit_events.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_dlgedit_events.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_dlgedit_events.cc       7 Apr 2002 09:51:28 -0000       1.2
--- gui_dlgedit_events.cc       12 Oct 2002 18:51:33 -0000      1.3
***************
*** 52,55 ****
--- 52,62 ----
  {
      GuiDlgedit *dlgedit = (GuiDlgedit *) user_data;
+     dlgedit->saveDialogue (dlgedit->filename ());
+ }
+ 
+ // File Menu: Save As
+ void on_file_save_as_activate (GtkMenuItem * menuitem, gpointer user_data)
+ {
+     GuiDlgedit *dlgedit = (GuiDlgedit *) user_data;
      GuiFile fs (SAVE, "Save dialogue source", dlgedit->filename ());
  

Index: gui_dlgedit_events.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_dlgedit_events.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_dlgedit_events.h        7 Apr 2002 09:51:28 -0000       1.2
--- gui_dlgedit_events.h        12 Oct 2002 18:51:33 -0000      1.3
***************
*** 29,32 ****
--- 29,33 ----
  void on_file_load_activate (GtkMenuItem *, gpointer);
  void on_file_save_activate (GtkMenuItem *, gpointer);
+ void on_file_save_as_activate (GtkMenuItem *, gpointer);
  void on_file_close_activate (GtkMenuItem *, gpointer);
  void on_dialogue_compile_activate (GtkMenuItem *, gpointer);

Index: gui_graph.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_graph.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gui_graph.cc        25 Jun 2002 16:25:52 -0000      1.3
--- gui_graph.cc        12 Oct 2002 18:51:33 -0000      1.4
***************
*** 23,27 ****
  #include "dlg_mover.h"
  #include "gui_dlgedit.h"
- #include "gui_tooltip.h"
  #include "gui_circle.h"
  #include "gui_graph_events.h"
--- 23,26 ----

Index: gui_graph.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_graph.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gui_graph.h 25 Jun 2002 16:25:52 -0000      1.3
--- gui_graph.h 12 Oct 2002 18:51:33 -0000      1.4
***************
*** 23,28 ****
  #define GUI_GRAPH_H
  
- #include <gdk/gdktypes.h>
- #include <gtk/gtkstyle.h>
  #include "gui_tooltip.h"
  #include "dlg_module.h"
--- 23,26 ----

Index: gui_list.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_list.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_list.cc 7 Apr 2002 09:51:28 -0000       1.2
--- gui_list.cc 12 Oct 2002 18:51:33 -0000      1.3
***************
*** 23,27 ****
  #include "gui_list.h"
  #include "gui_list_events.h"
- #include "dlg_circle.h"
  
  GuiList::GuiList (GtkWidget *paned)
--- 23,26 ----

Index: gui_list_events.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_list_events.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_list_events.cc  7 Apr 2002 09:51:28 -0000       1.2
--- gui_list_events.cc  12 Oct 2002 18:51:33 -0000      1.3
***************
*** 23,27 ****
  #include "gui_list_events.h"
  #include "gui_dlgedit.h"
- #include "dlg_circle.h"
  
  // Node selected in preview
--- 23,26 ----

Index: gui_messages.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_messages.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_messages.cc     7 Apr 2002 09:51:28 -0000       1.2
--- gui_messages.cc     12 Oct 2002 18:51:33 -0000      1.3
***************
*** 34,39 ****
      messages[2]     = " Load dialogue from disk";
      messages[3]     = " Save dialogue to disk";
!     messages[4]     = " Close current dialogue";
!     messages[5]     = " Exit the program";
      
      messages[10]    = " Change the preferences of the current dialogue";
--- 34,40 ----
      messages[2]     = " Load dialogue from disk";
      messages[3]     = " Save dialogue to disk";
!     messages[4]     = " Save dialogue under new name";
!     messages[5]     = " Close current dialogue";
!     messages[6]     = " Exit the program";
      
      messages[10]    = " Change the preferences of the current dialogue";

Index: gui_settings.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_settings.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** gui_settings.cc     1 Jul 2002 13:53:59 -0000       1.4
--- gui_settings.cc     12 Oct 2002 18:51:33 -0000      1.5
***************
*** 23,27 ****
  #include <sys/stat.h>
  #include <iostream>
- #include "dlg_types.h"
  #include "gui_file.h"
  #include "gui_dlgedit.h"
--- 23,26 ----
***************
*** 185,189 ****
  
  // display the dialog
! void GuiSettings::display (DlgModuleEntry *e, std::string &name)
  {
      if (entry != e)
--- 184,188 ----
  
  // display the dialog
! void GuiSettings::display (DlgModuleEntry *e, const std::string &name)
  {
      if (entry != e)
***************
*** 197,201 ****
      // set the title
      gchar *title = g_strjoin (NULL, "Settings - [", 
!         g_basename (name.c_str ()), "]", NULL);
      gtk_window_set_title (GTK_WINDOW (window), title);
  
--- 196,200 ----
      // set the title
      gchar *title = g_strjoin (NULL, "Settings - [", 
!         name.c_str (), "]", NULL);
      gtk_window_set_title (GTK_WINDOW (window), title);
  

Index: gui_settings.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_settings.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_settings.h      7 Apr 2002 09:51:28 -0000       1.2
--- gui_settings.h      12 Oct 2002 18:51:34 -0000      1.3
***************
*** 33,37 ****
--- 33,44 ----
  {
  public:
+     /**
+      * Create empty Settings Dialog.
+      */
      GuiSettings ();
+ 
+     /**
+      * Cleanup.
+      */
      ~GuiSettings ();
      
***************
*** 46,50 ****
       * @param name name of the dialogue whose settings are being edited.
       */
!     void display (DlgModuleEntry *entry, std::string &name);
  
      /**
--- 53,57 ----
       * @param name name of the dialogue whose settings are being edited.
       */
!     void display (DlgModuleEntry *entry, const std::string &name);
  
      /**

Index: main.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/main.cc,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -r1.57 -r1.58
*** main.cc     1 Jul 2002 13:53:59 -0000       1.57
--- main.cc     12 Oct 2002 18:51:34 -0000      1.58
***************
*** 88,92 ****
              }
              
!             module = new DlgModule (dialogue + "-1", "");
              
              // try to load from file
--- 88,92 ----
              }
              
!             module = new DlgModule ("", dialogue, "-1", "");
              
              // try to load from file





reply via email to

[Prev in Thread] Current Thread [Next in Thread]