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_node_gfx.cc,NON


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_node_gfx.cc,NONE,1.1 gui_resources.cc,NONE,1.1 gui_resources.h,NONE,1.1 Makefile.am,1.50,1.51 dlg_arrow.cc,1.5,1.6 dlg_arrow.h,1.6,1.7 dlg_circle.cc,1.7,1.8 dlg_circle.h,1.5,1.6 dlg_module.cc,1.10,1.11 dlg_module.h,1.10,1.11 dlg_node.cc,1.2,1.3 dlg_node.h,1.4,1.5 dlg_node_gfx.h,1.3,1.4 gui_dlgedit.cc,1.10,1.11 gui_dlgedit.h,1.9,1.10 gui_graph.cc,1.8,1.9 gui_graph.h,1.8,1.9 gui_graph_events.cc,1.3,1.4 gui_list.h,1.3,1.4 gui_tooltip.cc,1.3,1.4 gui_tooltip.h,1.2,1.3 gui_tree.cc,1.1,1.2 gui_tree.h,1.1,1.2
Date: Sat, 02 Nov 2002 13:40:05 -0500

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

Modified Files:
        Makefile.am dlg_arrow.cc dlg_arrow.h dlg_circle.cc 
        dlg_circle.h dlg_module.cc dlg_module.h dlg_node.cc dlg_node.h 
        dlg_node_gfx.h gui_dlgedit.cc gui_dlgedit.h gui_graph.cc 
        gui_graph.h gui_graph_events.cc gui_list.h gui_tooltip.cc 
        gui_tooltip.h gui_tree.cc gui_tree.h 
Added Files:
        dlg_node_gfx.cc gui_resources.cc gui_resources.h 
Log Message:
FIXED highlighting of sub-dialogue nodes
FIXED 'tooltip' position
MOVED some code around to break dependencies


***** Error reading new file: [Errno 2] No such file or directory: 
'dlg_node_gfx.cc'
***** Error reading new file: [Errno 2] No such file or directory: 
'gui_resources.cc'
***** Error reading new file: [Errno 2] No such file or directory: 
'gui_resources.h'
Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/Makefile.am,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** Makefile.am 1 Nov 2002 23:20:20 -0000       1.50
--- Makefile.am 2 Nov 2002 18:40:02 -0000       1.51
***************
*** 22,25 ****
--- 22,26 ----
      dlg_mover.cc \
      dlg_node.cc \
+     dlg_node_gfx.cc \
      dlg_point.cc \
      dlg_rect.cc \
***************
*** 38,41 ****
--- 39,43 ----
      gui_messages.cc \
      gui_modal_dialog.cc \
+     gui_resources.cc \
      gui_settings.cc \
      gui_tooltip.cc \
***************
*** 75,78 ****
--- 77,81 ----
      gui_messages.h \
      gui_modal_dialog.h \
+     gui_resources.h \
      gui_settings.h \
      gui_tooltip.h \

Index: dlg_arrow.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_arrow.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** dlg_arrow.cc        26 Oct 2002 17:43:29 -0000      1.5
--- dlg_arrow.cc        2 Nov 2002 18:40:02 -0000       1.6
***************
*** 21,27 ****
  
  #include <math.h>
- #include <gtk/gtk.h>
  #include "dlg_arrow.h"
! #include "gui_dlgedit.h"
  
  // Create a new link between two nodes
--- 21,26 ----
  
  #include <math.h>
  #include "dlg_arrow.h"
! #include "gui_resources.h"
  
  // Create a new link between two nodes
***************
*** 190,198 ****
  
  // draw the Arrow
! void DlgArrow::draw (GdkPixmap *surface, DlgPoint &point)
  {
      GdkPoint l[2];
      GdkPoint t[3];
!     GdkGC *gc = GuiDlgedit::window->getColor (mode_, type_);
      DlgRect area = inflate (10, 10);
      
--- 189,197 ----
  
  // draw the Arrow
! void DlgArrow::draw (GdkPixmap *surface, DlgPoint &point, GtkWidget *widget)
  {
      GdkPoint l[2];
      GdkPoint t[3];
!     GdkGC *gc = GuiResources::getColor (mode_, type_);
      DlgRect area = inflate (10, 10);
      
***************
*** 207,215 ****
      // draw everything
      gdk_draw_polygon (surface, gc, FALSE, l, 2);
!     gdk_draw_polygon (surface, GuiDlgedit::window->getColor (GC_WHITE), TRUE, 
t, 3);
      gdk_draw_polygon (surface, gc, FALSE, t, 3);
  
      // update drawing area
!     GuiDlgedit::window->graph ()->update (area);
  }
      
--- 206,214 ----
      // draw everything
      gdk_draw_polygon (surface, gc, FALSE, l, 2);
!     gdk_draw_polygon (surface, GuiResources::getColor (GC_WHITE), TRUE, t, 3);
      gdk_draw_polygon (surface, gc, FALSE, t, 3);
  
      // update drawing area
!     update (widget, area);
  }
      

Index: dlg_arrow.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_arrow.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** dlg_arrow.h 26 Oct 2002 22:19:44 -0000      1.6
--- dlg_arrow.h 2 Nov 2002 18:40:02 -0000       1.7
***************
*** 59,64 ****
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
       */
!     void draw (GdkPixmap *surface, DlgPoint &offset);
  
      /**
--- 59,65 ----
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
+      * @param widget the GtkWidget to update after drawing
       */
!     void draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget *widget);
  
      /**

Index: dlg_circle.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_circle.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** dlg_circle.cc       26 Oct 2002 22:19:44 -0000      1.7
--- dlg_circle.cc       2 Nov 2002 18:40:02 -0000       1.8
***************
*** 20,26 ****
   */
  
- #include <gtk/gtk.h>
  #include "dlg_circle.h"
! #include "gui_dlgedit.h"
  
  // Constructor
--- 20,25 ----
   */
  
  #include "dlg_circle.h"
! #include "gui_resources.h"
  
  // Constructor
***************
*** 76,83 ****
  
  // draw the circle
! void DlgCircle::draw (GdkPixmap *surface, DlgPoint &os)
  {
      // get the color for drawing the circle
!     GdkGC *gc = GuiDlgedit::window->getColor (mode_, type_);
      
      // offset circle
--- 75,82 ----
  
  // draw the circle
! void DlgCircle::draw (GdkPixmap *surface, DlgPoint &os, GtkWidget *widget)
  {
      // get the color for drawing the circle
!     GdkGC *gc = GuiResources::getColor (mode_, type_);
      
      // offset circle
***************
*** 86,90 ****
      
      // draw everything to the surface
!     gdk_draw_arc (surface, GuiDlgedit::window->getColor (GC_WHITE), TRUE, 
position.x (), position.y (), 20, 20, 0, 36000);
      gdk_draw_arc (surface, gc, FALSE, position.x (), position.y (), 20, 20, 
0, 36000);
      
--- 85,89 ----
      
      // draw everything to the surface
!     gdk_draw_arc (surface, GuiResources::getColor (GC_WHITE), TRUE, 
position.x (), position.y (), 20, 20, 0, 36000);
      gdk_draw_arc (surface, gc, FALSE, position.x (), position.y (), 20, 20, 
0, 36000);
      
***************
*** 98,102 ****
          
          // get the font to use
!         GdkFont *font = GuiDlgedit::window->font ();
      
          // place text in circles center
--- 97,101 ----
          
          // get the font to use
!         GdkFont *font = GuiResources::font ();
      
          // place text in circles center
***************
*** 109,113 ****
      
      // Update the drawing area
!     GuiDlgedit::window->graph ()->update (area);
  }
  
--- 108,112 ----
      
      // Update the drawing area
!     update (widget, area);
  }
  

Index: dlg_circle.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_circle.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** dlg_circle.h        17 Oct 2002 10:08:42 -0000      1.5
--- dlg_circle.h        2 Nov 2002 18:40:02 -0000       1.6
***************
*** 88,93 ****
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
       */
!     void draw (GdkPixmap *surface, DlgPoint &offset);
  
      /**
--- 88,94 ----
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
+      * @param widget the GtkWidget to update after drawing
       */
!     void draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget *widget);
  
      /**

Index: dlg_module.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** dlg_module.cc       1 Nov 2002 23:20:20 -0000       1.10
--- dlg_module.cc       2 Nov 2002 18:40:02 -0000       1.11
***************
*** 20,29 ****
   */
  
- #include <gtk/gtk.h>
  #include <algorithm>
  #include "dlg_module.h"
  #include "dlg_circle.h"
  #include "dlg_arrow.h"
! #include "gui_dlgedit.h"
  
  // ctor
--- 20,28 ----
   */
  
  #include <algorithm>
  #include "dlg_module.h"
  #include "dlg_circle.h"
  #include "dlg_arrow.h"
! #include "gui_resources.h"
  
  // ctor
***************
*** 42,46 ****
  {
      type_ = MODULE;
!     mode_ = IDLE;
      selected_ = NULL;
      highlighted_ = NULL;
--- 41,45 ----
  {
      type_ = MODULE;
!     state_ = IDLE;
      selected_ = NULL;
      highlighted_ = NULL;
***************
*** 66,70 ****
  {
      // calculate width of the module icon
!     GdkFont *font = GuiDlgedit::window->font ();
      int width = gdk_string_width (font, name ().c_str ()) + 10;
      
--- 65,69 ----
  {
      // calculate width of the module icon
!     GdkFont *font = GuiResources::font ();
      int width = gdk_string_width (font, name ().c_str ()) + 10;
      
***************
*** 90,94 ****
      
      // set the mode of dialogue and node
!     mode_ = NODE_SELECTED;
      node->setMode (NODE_SELECTED);
  
--- 89,93 ----
      
      // set the mode of dialogue and node
!     state_ = NODE_SELECTED;
      node->setMode (NODE_SELECTED);
  
***************
*** 189,193 ****
  
      // unselect node
!     mode_ = IDLE;
      selected_->setMode (IDLE);
      
--- 188,192 ----
  
      // unselect node
!     state_ = IDLE;
      selected_->setMode (IDLE);
      
***************
*** 200,207 ****
  
  // draw the module
! void DlgModule::draw (GdkPixmap *surface, DlgPoint &offset)
  {
      // get the color for drawing the circle
!     GdkGC *gc = GuiDlgedit::window->getColor (mode_, type_);
  
      // offset circle
--- 199,206 ----
  
  // draw the module
! void DlgModule::draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget *widget)
  {
      // get the color for drawing the circle
!     GdkGC *gc = GuiResources::getColor (mode_, type_);
  
      // offset circle
***************
*** 210,218 ****
  
      // draw everything to the surface
!     gdk_draw_rectangle (surface, GuiDlgedit::window->getColor (GC_WHITE), 
TRUE, position.x (), position.y (), width (), height ());
      gdk_draw_rectangle (surface, gc, FALSE, position.x (), position.y (), 
width (), height ());
  
      // get the font to draw name
!     GdkFont *font = GuiDlgedit::window->font ();
  
      // place text in module's center
--- 209,217 ----
  
      // draw everything to the surface
!     gdk_draw_rectangle (surface, GuiResources::getColor (GC_WHITE), TRUE, 
position.x (), position.y (), width (), height ());
      gdk_draw_rectangle (surface, gc, FALSE, position.x (), position.y (), 
width (), height ());
  
      // get the font to draw name
!     GdkFont *font = GuiResources::font ();
  
      // place text in module's center
***************
*** 222,226 ****
  
      // Update the drawing area
!     GuiDlgedit::window->graph ()->update (area);
  }
  
--- 221,225 ----
  
      // Update the drawing area
!     update (widget, area);
  }
  

Index: dlg_module.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** dlg_module.h        1 Nov 2002 23:20:20 -0000       1.10
--- dlg_module.h        2 Nov 2002 18:40:02 -0000       1.11
***************
*** 67,72 ****
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
       */
!     void draw (GdkPixmap *surface, DlgPoint &offset);
      //@}
      
--- 67,73 ----
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
+      * @param widget the GtkWidget to update after drawing
       */
!     void draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget *widget);
      //@}
      
***************
*** 240,243 ****
--- 241,256 ----
      void setParent (DlgModule *parent)  { parent_ = parent; }
      
+     /** 
+      * Get the current state of the module, i.e. whether a node is selected,
+      * highlighted, etc ... .
+      * @return The module's state.
+      */
+     mode_type state ()                  { return state_; }
+     /** 
+      * Set the state mode of the module.
+      * @param state The modules new state.
+      */
+     void setState (mode_type state)     { state_ = state; }
+     
      /**
       * Get a pointer to the module entry
***************
*** 264,267 ****
--- 277,282 ----
      bool changed_;              // Whether there were changes since saving
      int nid_;                   // Id to use for the next new node
+ 
+     mode_type state_;           // one of NONE, HILIGHTED, SELECTED
  
      std::string name_;          // Short (file-) name of the dialogue 

Index: dlg_node.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_node.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** dlg_node.cc 7 Apr 2002 09:51:28 -0000       1.2
--- dlg_node.cc 2 Nov 2002 18:40:02 -0000       1.3
***************
*** 144,148 ****
  
  // draw the node (with a certain mode)
! void DlgNode::draw (GdkPixmap *surface, DlgPoint &offset, mode_type m)
  {
      // change the mode temporarily
--- 144,148 ----
  
  // draw the node (with a certain mode)
! void DlgNode::draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget *widget, 
mode_type m)
  {
      // change the mode temporarily
***************
*** 151,155 ****
      
      // draw
!     draw (surface, offset);
      
      // restore old mode
--- 151,155 ----
      
      // draw
!     draw (surface, offset, widget);
      
      // restore old mode

Index: dlg_node.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_node.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** dlg_node.h  12 Oct 2002 18:51:33 -0000      1.4
--- dlg_node.h  2 Nov 2002 18:40:02 -0000       1.5
***************
*** 116,122 ****
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
       * @param mode the new mode of the node
       */
!     void draw (GdkPixmap *surface, DlgPoint &offset, mode_type mode);
      
      /**
--- 116,123 ----
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
+      * @param widget the GtkWidget to update after drawing
       * @param mode the new mode of the node
       */
!     void draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget *widget, 
mode_type mode);
      
      /**
***************
*** 124,129 ****
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
       */
!     virtual void draw (GdkPixmap *surface, DlgPoint &offset) { }
      
      /**
--- 125,133 ----
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
+      * @param widget the GtkWidget to update after drawing
       */
!     virtual void draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget 
*widget)
!     { 
!     }
      
      /**

Index: dlg_node_gfx.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_node_gfx.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** dlg_node_gfx.h      12 Oct 2002 18:51:33 -0000      1.3
--- dlg_node_gfx.h      2 Nov 2002 18:40:02 -0000       1.4
***************
*** 23,26 ****
--- 23,27 ----
  #define DLG_NODE_GFX_H
  
+ #include <gtk/gtkstyle.h>
  #include "dlg_rect.h"
  #include "dlg_types.h"
***************
*** 52,61 ****
      
      /**
       * Draw this node to the given surface with the specified offset. 
       * The node's current mode determines the color thw node is drawn with. 
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
       */
!     virtual void draw (GdkPixmap *surface, DlgPoint &offset) = 0;
  
      /**
--- 53,70 ----
      
      /**
+      * Blit a certain area of the graph widget to the screen
+      * @param widget the widget to update
+      * @param area the rectangular area to update.
+      */
+     void update (GtkWidget *widget, DlgRect &area);
+     
+     /**
       * Draw this node to the given surface with the specified offset. 
       * The node's current mode determines the color thw node is drawn with. 
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
+      * @param widget the GtkWidget to update after drawing
       */
!     virtual void draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget 
*widget) = 0;
  
      /**
***************
*** 64,70 ****
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
       * @param mode the new mode of the node
       */
!     virtual void draw (GdkPixmap *surface, DlgPoint &offset, mode_type mode) 
= 0;
         
      /**
--- 73,80 ----
       * @param surface the GdkPixmap to draw to
       * @param offset the DlgPoint to use as offset
+      * @param widget the GtkWidget to update after drawing
       * @param mode the new mode of the node
       */
!     virtual void draw (GdkPixmap *surface, DlgPoint &offset, GtkWidget 
*widget, mode_type mode) = 0;
         
      /**

Index: gui_dlgedit.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_dlgedit.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** gui_dlgedit.cc      1 Nov 2002 23:20:20 -0000       1.10
--- gui_dlgedit.cc      2 Nov 2002 18:40:02 -0000       1.11
***************
*** 37,40 ****
--- 37,41 ----
  #include "gui_code.h"
  #include "gui_settings.h"
+ #include "gui_resources.h"
  #include "gui_dlgedit.h"
  #include "gui_dlgedit_events.h"
***************
*** 97,103 ****
      number = 0;
      
-     for (int i = 0; i < MAX_GC; i++)
-         color[i] = NULL;
-     
      // Statusbar for displaying help and error messages
      GtkWidget *status_help = gtk_statusbar_new ();
--- 98,101 ----
***************
*** 370,379 ****
      message->display (1000);
  
-     // font to use on the drawing area
-     font_ = gdk_font_load 
("-*-*-medium-r-normal-sans-12-*-*-*-*-*-iso8859-1");
- 
-     // init the colors we need for drawing
-     initColors (graph_->drawingArea ());
- 
      // init list of previously opened files
      initRecentFiles ();
--- 368,371 ----
***************
*** 382,385 ****
--- 374,380 ----
      directory_ = g_get_current_dir ();
      
+     // init the resources we will need
+     GuiResources::init (graph_->drawingArea ());
+ 
      clear ();
  }
***************
*** 755,759 ****
      if (module != NULL) 
      {
!         setMode (module->mode ());
          
          // deselect selected node, if any
--- 750,754 ----
      if (module != NULL) 
      {
!         setMode (module->state ());
          
          // deselect selected node, if any
***************
*** 901,982 ****
  }
  
- // Prepare some colors for later use
- void GuiDlgedit::initColors (GtkWidget *graph)
- {
-     GdkColor c;
- 
-     // Yellow
-     color[GC_YELLOW] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 65535;
-     c.green = 32700;
-     c.blue = 0;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (wnd), &c, TRUE, TRUE);
-     gdk_gc_set_foreground (color[GC_YELLOW], &c);
- 
-     // Orange
-     color[GC_RED] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 65535;
-     c.green = 16350;
-     c.blue = 0;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (graph), &c, TRUE, 
TRUE);
-     gdk_gc_set_foreground (color[GC_RED], &c);
- 
-     // Dark Red
-     color[GC_DARK_RED] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 65535;
-     c.green = 0;
-     c.blue = 0;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (wnd), &c, TRUE, TRUE);
-     gdk_gc_set_foreground (color[GC_DARK_RED], &c);
- 
-     // Dark Blue
-     color[GC_DARK_BLUE] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 0;
-     c.green = 0;
-     c.blue = 35000;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (wnd), &c, TRUE, TRUE);
-     gdk_gc_set_foreground (color[GC_DARK_BLUE], &c);
- 
-     // Green
-     color[GC_GREEN] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 16000;
-     c.green = 50000;
-     c.blue = 5000;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (wnd), &c, TRUE, TRUE);
-     gdk_gc_set_foreground (color[GC_GREEN], &c);
- 
-     // Dark Green
-     color[GC_DARK_GREEN] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 0;
-     c.green = 27300;
-     c.blue = 15600;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (wnd), &c, TRUE, TRUE);
-     gdk_gc_set_foreground (color[GC_DARK_GREEN], &c);
- 
-     // Grey
-     color[GC_GREY] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 40000;
-     c.green = 40000;
-     c.blue = 40000;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (wnd), &c, TRUE, TRUE);
-     gdk_gc_set_foreground (color[GC_GREY], &c);
- 
-     // Black
-     color[GC_BLACK] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 0;
-     c.green = 0;
-     c.blue = 0;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (wnd), &c, TRUE, TRUE);
-     gdk_gc_set_foreground (color[GC_BLACK], &c);
-     
-     // White
-     color[GC_WHITE] = gdk_gc_new (gtk_widget_get_parent_window (graph));
-     c.red = 65535;
-     c.green = 65535;
-     c.blue = 65535;
-     gdk_colormap_alloc_color (gtk_widget_get_colormap (wnd), &c, TRUE, TRUE);
-     gdk_gc_set_foreground (color[GC_WHITE], &c);
- }
- 
  void GuiDlgedit::clear ()
  {
--- 896,899 ----
***************
*** 1029,1078 ****
      // add the new status
      gtk_statusbar_push (GTK_STATUSBAR (status_mode), id, text);
- }
- 
- 
- // Get a certain predefined color
- GdkGC *GuiDlgedit::getColor (int col)
- {
-     if (col < 0 || col > MAX_GC) return NULL;
-     else return color[col];
- }
- 
- // Get the right color for a (mode, type) combination
- GdkGC *GuiDlgedit::getColor (mode_type mode, node_type type)
- {    
-     switch (mode)
-     {
-         // not selected    
-         case IDLE:
-         {
-             if (type == NPC || type == LINK || type == MODULE) return 
color[GC_BLACK];
-             else if (type == NARRATOR) return color[GC_DARK_GREEN];
-             else return color[GC_DARK_BLUE];
-             break;
-         }
- 
-         // selected
-         case NODE_SELECTED:
-         {
-             if (type == NPC || type == LINK || type == MODULE) return 
color[GC_DARK_RED];
-             else if (type == NARRATOR) return color[GC_YELLOW];
-             else return color[GC_RED];
-             break;
-         }
- 
-         // highlighted
-         case NODE_HILIGHTED:
-         {
-             return color[GC_GREEN];
-             break;
-         }
- 
-         // unknown
-         default:
-             break;
-     }
- 
-     return NULL;
  }
  
--- 946,949 ----

Index: gui_dlgedit.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_dlgedit.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** gui_dlgedit.h       1 Nov 2002 23:20:20 -0000       1.9
--- gui_dlgedit.h       2 Nov 2002 18:40:02 -0000       1.10
***************
*** 76,104 ****
      
      /**
-      * Retrieve the font used to draw text onto a drawing area.
-      * @return a GdkFont.
-      */
-     GdkFont *font ()        { return font_; }
- 
-     /**
       * Retrieve the main window of the applictaion.
       * @return a GtkWidget.
       */
      GtkWidget *getWindow () { return wnd; }
- 
-     /**
-      * Retrieve a colored 'pen' to draw onto a drawing area.
-      * @param col the color to retrieve
-      * @return a GdkGC.
-      */
-     GdkGC *getColor (int col);
-     /**
-      * Retrieve a colored 'pen' to draw onto a drawing area, depending
-      * on the given mode and type.
-      * @param mode the mode of a DlgNode
-      * @param type the type of a DlgNode
-      * @return a GdkGC.
-      */
-     GdkGC *getColor (mode_type mode, node_type type);
      //@}
      
--- 76,83 ----
***************
*** 193,201 ****
  private:
      /**
-      * Prepare some colored pens for later use
-      * @param widget the widget we later draw to 
-      */
-     void initColors (GtkWidget *widget);
-     /**
       * (Re)build the 'windows' menu 
       */
--- 172,175 ----
***************
*** 228,233 ****
      GtkWidget *windowMenu;          // the 'Windows' dropdown menu
      GtkWidget *status_mode;         // statusbar displaying the program state
-     GdkFont *font_;                 // font for text-output
-     GdkGC *color[MAX_GC];           // custom Pens
      std::vector<DlgModule*> dialogues_;// dialogues currently loaded
      std::string directory_;            // directory used in last 
file-selection
--- 202,205 ----

Index: gui_graph.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_graph.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** gui_graph.cc        1 Nov 2002 23:20:20 -0000       1.8
--- gui_graph.cc        2 Nov 2002 18:40:02 -0000       1.9
***************
*** 24,30 ****
  #include "dlg_mover.h"
  #include "gui_dlgedit.h"
  #include "gui_circle.h"
  #include "gui_file.h"
- #include "gui_graph_events.h"
  
  // Constructor
--- 24,31 ----
  #include "dlg_mover.h"
  #include "gui_dlgedit.h"
+ #include "gui_graph_events.h"
+ #include "gui_resources.h"
  #include "gui_circle.h"
  #include "gui_file.h"
  
  // Constructor
***************
*** 37,41 ****
      surface = NULL;
      scrolling = false;
-     updateBackground = true;
      
      // create drawing area for the graph
--- 38,41 ----
***************
*** 76,80 ****
  
      // update the program state
!     GuiDlgedit::window->setMode (module->mode ());
  
      // set the size of the dialogue
--- 76,80 ----
  
      // update the program state
!     GuiDlgedit::window->setMode (module->state ());
  
      // set the size of the dialogue
***************
*** 190,194 ****
      // ... and update everything
      GuiDlgedit::window->list ()->display (start);
!       arrow->draw (surface, *offset);
      module->setChanged ();
      
--- 190,194 ----
      // ... and update everything
      GuiDlgedit::window->list ()->display (start);
!       arrow->draw (surface, *offset, graph);
      module->setChanged ();
      
***************
*** 221,225 ****
          // draw the sub-dialogue
          subdlg->initShape (point);
!         subdlg->draw (surface, *offset);
  
          // update the module
--- 221,225 ----
          // draw the sub-dialogue
          subdlg->initShape (point);
!         subdlg->draw (surface, *offset, graph);
  
          // update the module
***************
*** 283,287 ****
          
          // redraw the node
!         node->draw (surface, *offset);
  
          return true;
--- 283,287 ----
          
          // redraw the node
!         node->draw (surface, *offset, graph);
  
          return true;
***************
*** 309,319 ****
      if (node == NULL) return false;
  
-     // if we have a sub-dialogue, descent
-     if (node->type () == MODULE)
-     {
-         switchModule ((DlgModule *) node);
-         return true;
-     }
- 
      // otherwise select the node
      if (selectNode (node))
--- 309,312 ----
***************
*** 440,444 ****
          
          // redraw the node
!         deselected->draw (surface, *offset);
      }
      
--- 433,437 ----
          
          // redraw the node
!         deselected->draw (surface, *offset, graph);
      }
      
***************
*** 497,516 ****
      
      // see if a node is currently selected
!     DlgCircle *selected = (DlgCircle *) module->selected ();
  
!     // if so ...
      if (selected && selected->type () != LINK)
      {
!         // disable scrolling (just in case)
!         scrolling = false;
!         
!         GuiCircle edit (&selected->type (), selected->entry (), module->entry 
());
  
!           // Editing aborted?
            if (!edit.run ()) return false;
        
            // otherwise update everything
          GuiDlgedit::window->list ()->display (selected);
!           selected->draw (surface, *offset);
          module->setChanged ();
          
--- 490,516 ----
      
      // see if a node is currently selected
!     DlgNode *selected = module->selected ();
  
!     // disable scrolling (just in case)
!     scrolling = false;
! 
!     // if we have a sub-dialogue, descent for editing
!     if (selected->type () == MODULE)
!     {
!         switchModule ((DlgModule *) selected);
!         return true;
!     }
! 
!     // if we have a circle, open edit dialog
      if (selected && selected->type () != LINK)
      {
!         GuiCircle edit (&selected->type (), ((DlgCircle *) selected)->entry 
(), module->entry ());
  
!           // editing aborted?
            if (!edit.run ()) return false;
        
            // otherwise update everything
          GuiDlgedit::window->list ()->display (selected);
!           selected->draw (surface, *offset, graph);
          module->setChanged ();
          
***************
*** 573,577 ****
      {
          GuiDlgedit::window->setMode (NODE_DRAGGED);
!         module->setMode (NODE_DRAGGED);
          
          return true;
--- 573,577 ----
      {
          GuiDlgedit::window->setMode (NODE_DRAGGED);
!         module->setState (NODE_DRAGGED);
          
          return true;
***************
*** 656,660 ****
          GuiDlgedit::window->list ()->display (module->selected ());
          GuiDlgedit::window->setMode (NODE_SELECTED);
!         module->setMode (NODE_SELECTED);
          module->setChanged ();
      }
--- 656,660 ----
          GuiDlgedit::window->list ()->display (module->selected ());
          GuiDlgedit::window->setMode (NODE_SELECTED);
!         module->setState (NODE_SELECTED);
          module->setChanged ();
      }
***************
*** 677,681 ****
  
      // init the surface
!     if (GuiDlgedit::window->getColor (GC_GREY)) clear ();
              
      // set the size of the attached dialogues
--- 677,681 ----
  
      // init the surface
!     if (GuiResources::getColor (GC_GREY)) clear ();
              
      // set the size of the attached dialogues
***************
*** 688,692 ****
      GdkRectangle t;
  
!     gdk_draw_rectangle (surface, GuiDlgedit::window->getColor (GC_GREY), 
          TRUE, 0, 0, graph->allocation.width, graph->allocation.height);
  
--- 688,692 ----
      GdkRectangle t;
  
!     gdk_draw_rectangle (surface, GuiResources::getColor (GC_GREY), 
          TRUE, 0, 0, graph->allocation.width, graph->allocation.height);
  
***************
*** 699,711 ****
  }
  
- // update the graph widget
- void GuiGraph::update (DlgRect &area)
- {
-     if (updateBackground == false) return;
-     
-     GdkRectangle rect = (GdkRectangle) area;
-     gtk_widget_draw (graph, &rect);
- }
- 
  // draw the graph to the surface
  void GuiGraph::draw ()
--- 699,702 ----
***************
*** 726,734 ****
      DlgRect rect (t);
  
-     // prevent changes to the drawing area to propagate to the screen
-     updateBackground = false;
-     
      // Clear graph
!     gdk_draw_rectangle (surface, GuiDlgedit::window->getColor (GC_WHITE), 
TRUE, 0, 0, t.width, t.height);
  
      // normalize rect
--- 717,722 ----
      DlgRect rect (t);
  
      // Clear graph
!     gdk_draw_rectangle (surface, GuiResources::getColor (GC_WHITE), TRUE, 0, 
0, t.width, t.height);
  
      // normalize rect
***************
*** 740,747 ****
          // draw nodes and arrows
          if ((*i)->contains (rect))
!             (*i)->draw (surface, *offset);
! 
!     // allow that again
!     updateBackground = true;
  
      // draw backing image to screen
--- 728,732 ----
          // draw nodes and arrows
          if ((*i)->contains (rect))
!             (*i)->draw (surface, *offset, NULL);
  
      // draw backing image to screen
***************
*** 770,774 ****
          if (prev != NULL)
          {
!             prev->draw (surface, *offset);
              if (tooltip) 
              {
--- 755,759 ----
          if (prev != NULL)
          {
!             prev->draw (surface, *offset, graph);
              if (tooltip) 
              {
***************
*** 781,785 ****
          if (node != NULL) 
          {
!             node->draw (surface, *offset, NODE_HILIGHTED);
              tooltip = new GuiTooltip (node);
              tooltip->draw (graph, *offset);
--- 766,770 ----
          if (node != NULL) 
          {
!             node->draw (surface, *offset, graph, NODE_HILIGHTED);
              tooltip = new GuiTooltip (node);
              tooltip->draw (graph, *offset);

Index: gui_graph.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_graph.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** gui_graph.h 1 Nov 2002 23:20:20 -0000       1.8
--- gui_graph.h 2 Nov 2002 18:40:02 -0000       1.9
***************
*** 79,87 ****
      void mouseMoved (DlgPoint &point);
      /**
-      * Blit a certain area of the graph widget to the screen
-      * @param the rectangular area to update.
-      */
-     void update (DlgRect &area);
-     /**
       * Draw everything to the backing pixmap.
       */
--- 79,82 ----
***************
*** 280,284 ****
       * @return the attached DlgModule's state. 
       */
!     mode_type mode ()           { return module ? module->mode () : IDLE; }
      //@}
      
--- 275,279 ----
       * @return the attached DlgModule's state. 
       */
!     mode_type mode ()           { return module ? module->state () : IDLE; }
      //@}
      
***************
*** 293,297 ****
      bool scrolling;         // Indicates whether autoscrolling is active
      DlgPoint scroll_offset; // Offset by which the view moves during scrolling
-     bool updateBackground;  // Don't show updates to the drawing area
  };
  
--- 288,291 ----

Index: gui_graph_events.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_graph_events.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gui_graph_events.cc 24 Oct 2002 20:12:56 -0000      1.3
--- gui_graph_events.cc 2 Nov 2002 18:40:02 -0000       1.4
***************
*** 74,78 ****
                      graph->newModule (point);
       
-             
              // Edit node
              if (graph->mode () == NODE_SELECTED)
--- 74,77 ----

Index: gui_list.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_list.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gui_list.h  1 Nov 2002 23:20:20 -0000       1.3
--- gui_list.h  2 Nov 2002 18:40:02 -0000       1.4
***************
*** 23,27 ****
  #define GUI_LIST_H
  
- #include <gtk/gtkstyle.h>
  #include "dlg_circle.h"
  
--- 23,26 ----

Index: gui_tooltip.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_tooltip.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gui_tooltip.cc      24 Oct 2002 20:12:56 -0000      1.3
--- gui_tooltip.cc      2 Nov 2002 18:40:02 -0000       1.4
***************
*** 21,26 ****
  
  #include <gtk/gtk.h>
  #include "gui_tooltip.h"
- #include "gui_dlgedit.h"
  
  // constructor
--- 21,27 ----
  
  #include <gtk/gtk.h>
+ #include "dlg_circle.h"
+ #include "dlg_module.h"
  #include "gui_tooltip.h"
  
  // constructor
***************
*** 87,96 ****
  {
      if (node->type () == LINK) return;
      
-     int x, y;
-     gdk_window_get_origin (gtk_widget_get_parent_window (graph), &x, &y);
      gtk_widget_realize (tooltip);
      
      // calculate the position of the tooltip
      if (node->x () < graph->allocation.width / 2) 
          x += node->x () + node->width ();
--- 88,102 ----
  {
      if (node->type () == LINK) return;
+ 
+     // get position and extension of dlgedit window    
+     int x, y, width, height;
+     GdkWindow *window = gtk_widget_get_parent_window (graph);
+     gdk_window_get_origin (window, &x, &y);
+     gdk_window_get_size (window, &width, &height);
      
      gtk_widget_realize (tooltip);
      
      // calculate the position of the tooltip
+     x += width - graph->allocation.width;
      if (node->x () < graph->allocation.width / 2) 
          x += node->x () + node->width ();

Index: gui_tooltip.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_tooltip.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gui_tooltip.h       7 Apr 2002 09:51:28 -0000       1.2
--- gui_tooltip.h       2 Nov 2002 18:40:02 -0000       1.3
***************
*** 23,27 ****
  #define GUI_TOOLTIP_H
  
- #include <gtk/gtkstyle.h>
  #include "dlg_node.h"
  
--- 23,26 ----

Index: gui_tree.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_tree.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** gui_tree.cc 1 Nov 2002 23:20:20 -0000       1.1
--- gui_tree.cc 2 Nov 2002 18:40:02 -0000       1.2
***************
*** 111,115 ****
          // if we find a sub-dialogue
          if ((*i)->type () == MODULE)
!             // insert it into the tree and continue with it's sub-dialogues
              build (insert (root, (DlgModule *) *i));
  }
--- 111,115 ----
          // if we find a sub-dialogue
          if ((*i)->type () == MODULE)
!             // insert it into the tree and continue with its sub-dialogues
              build (insert (root, (DlgModule *) *i));
  }

Index: gui_tree.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_tree.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** gui_tree.h  1 Nov 2002 23:20:20 -0000       1.1
--- gui_tree.h  2 Nov 2002 18:40:02 -0000       1.2
***************
*** 23,27 ****
  #define GUI_TREE_H
  
- #include <gtk/gtkstyle.h>
  #include <gtk/gtkctree.h>
  #include "dlg_module.h"
--- 23,26 ----





reply via email to

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