Author: matt
Date: 2011-07-28 05:43:38 -0700 (Thu, 28 Jul 2011)
New Revision: 8876
Log:
simple Worksapce Properties Panel

Modified:
   branches/branch-3.0/fluid/Fl_Type.cxx
   branches/branch-3.0/fluid/Fl_Type.h
   branches/branch-3.0/fluid/workspace_panel.cxx
   branches/branch-3.0/fluid/workspace_panel.fl
   branches/branch-3.0/fluid/workspace_panel.h

Modified: branches/branch-3.0/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.cxx       2011-07-28 12:20:33 UTC (rev 
8875)
+++ branches/branch-3.0/fluid/Fl_Type.cxx       2011-07-28 12:43:38 UTC (rev 
8876)
@@ -192,6 +192,11 @@
 
 ////////////////////////////////////////////////////////////////
 
+unsigned int wks_env = 0;
+char *wks_name = 0L;
+
+////////////////////////////////////////////////////////////////
+
 class Widget_Browser : public fltk3::Browser_ {
   friend class Fl_Type;
 

Modified: branches/branch-3.0/fluid/Fl_Type.h
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.h 2011-07-28 12:20:33 UTC (rev 8875)
+++ branches/branch-3.0/fluid/Fl_Type.h 2011-07-28 12:43:38 UTC (rev 8876)
@@ -43,6 +43,9 @@
 
 void set_modflag(int mf);
 
+extern unsigned int wks_env;
+extern char *wks_name;
+
 class Fl_Type {
 
   friend class Widget_Browser;

Modified: branches/branch-3.0/fluid/workspace_panel.cxx
===================================================================
--- branches/branch-3.0/fluid/workspace_panel.cxx       2011-07-28 12:20:33 UTC 
(rev 8875)
+++ branches/branch-3.0/fluid/workspace_panel.cxx       2011-07-28 12:43:38 UTC 
(rev 8876)
@@ -149,92 +149,82 @@
 end();
 }
 
+/**
+   Set the environment flags
+*/
+void Fl_Environment_Choice::value(unsigned int v) {
+  pEnv = v;
+  cb_pMenuAll_i(0, 0);
+}
+
+/**
+   Get the environment flags
+*/
+unsigned int Fl_Environment_Choice::value() {
+  return pEnv;
+}
+
 fltk3::DoubleWindow *workspace_panel=(fltk3::DoubleWindow *)0;
 
+fltk3::Input *pName=(fltk3::Input *)0;
+
+Fl_Environment_Choice *pEnv=(Fl_Environment_Choice *)0;
+
+static void cb_OK(fltk3::Button*, void*) {
+  if (wks_name) free(wks_name);
+wks_name = strdup(pName->value());
+wks_env = pEnv->value();
+workspace_panel->hide();
+}
+
 fltk3::DoubleWindow* show_workspace_panel() {
   if (!workspace_panel) {
-    { workspace_panel = new fltk3::DoubleWindow(385, 416);
-      { fltk3::Button* o = new fltk3::Button(265, 365, 95, 25, "OK");
-        o->labelsize(12);
-      } // fltk3::Button* o
-      { fltk3::Input* o = new fltk3::Input(85, 15, 213, 25, "Name:");
-        o->tooltip("name of the target - this will be used in the IDEs and as 
a general reference\
+    { workspace_panel = new fltk3::DoubleWindow(274, 173, "Workspace 
Properties");
+      { pName = new fltk3::Input(85, 15, 170, 25, "Name:");
+        pName->tooltip("name of the target - this will be used in the IDEs and 
as a general reference\
 .");
-        o->labelsize(12);
-        o->textsize(12);
-      } // fltk3::Input* o
-      { fltk3::Box* o = new fltk3::Box(10, 49, 362, 2, "Environments");
+        pName->labelsize(12);
+        pName->textsize(12);
+      } // fltk3::Input* pName
+      { fltk3::Box* o = new fltk3::Box(10, 50, 288, 2, "Create Build 
Enviroments for:");
         o->box(fltk3::THIN_DOWN_FRAME);
         o->labelsize(12);
         o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_LEFT));
       } // fltk3::Box* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(85, 83, 215, 20, 
"Universal Command Line");
-        o->down_box(fltk3::DOWN_BOX);
+      { pEnv = new Fl_Environment_Choice(85, 71, 170, 40);
+        pEnv->box(fltk3::FLAT_BOX);
+        pEnv->color(fltk3::BACKGROUND_COLOR);
+        pEnv->selection_color(fltk3::SELECTION_COLOR);
+        pEnv->labeltype(fltk3::NORMAL_LABEL);
+        pEnv->labelfont(0);
+        pEnv->labelsize(14);
+        pEnv->labelcolor(fltk3::FOREGROUND_COLOR);
+        pEnv->align(fltk3::Align(fltk3::ALIGN_CENTER));
+        pEnv->when(fltk3::WHEN_RELEASE_ALWAYS);
+      } // Fl_Environment_Choice* pEnv
+      { fltk3::Button* o = new fltk3::Button(160, 130, 95, 25, "OK");
         o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(85, 143, 215, 20, "MS 
Windows (tm)");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(100, 163, 215, 20, 
"VisualC 6 ");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(100, 183, 215, 20, 
"VisualC 2008");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(100, 203, 215, 20, 
"VisualC 2010");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(85, 223, 215, 20, 
"Apple OS X (tm)");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(100, 243, 215, 20, 
"Xcode 3");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-        o->deactivate();
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(100, 263, 215, 20, 
"Xcode 4");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(101, 103, 215, 20, 
"Makefile (make, gmake)");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(101, 123, 215, 20, 
"CMake File (cmake)");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-        o->deactivate();
-      } // fltk3::CheckButton* o
-      { fltk3::CheckButton* o = new fltk3::CheckButton(70, 64, 215, 20, "all 
supported Environments");
-        o->down_box(fltk3::DOWN_BOX);
-        o->labelsize(12);
-      } // fltk3::CheckButton* o
-      { Fl_Environment_Choice* o = new Fl_Environment_Choice(85, 295, 170, 40);
-        o->box(fltk3::FLAT_BOX);
-        o->color(fltk3::LIGHT2);
-        o->selection_color(fltk3::SELECTION_COLOR);
-        o->labeltype(fltk3::NORMAL_LABEL);
-        o->labelfont(0);
-        o->labelsize(14);
-        o->labelcolor(fltk3::FOREGROUND_COLOR);
-        o->align(fltk3::Align(fltk3::ALIGN_CENTER));
-        o->when(fltk3::WHEN_RELEASE_ALWAYS);
-      } // Fl_Environment_Choice* o
+        o->callback((fltk3::Callback*)cb_OK);
+      } // fltk3::Button* o
+      workspace_panel->set_modal();
       workspace_panel->end();
     } // fltk3::DoubleWindow* workspace_panel
       }
+      if (wks_name) 
+        pName->value(wks_name);
+      else
+        pName->value("unnamed workspace");
+      if (wks_env)  
+        pEnv->value(wks_env);  
+      else
+        pEnv->value(Fl_Environment_Choice::ENV_ALL);
       workspace_panel->show();
   return workspace_panel;
 }
 
 fltk3::DoubleWindow* make_app_target_panel() {
   fltk3::DoubleWindow* w;
-  { fltk3::DoubleWindow* o = new fltk3::DoubleWindow(307, 281, "Appliction 
Target");
+  { fltk3::DoubleWindow* o = new fltk3::DoubleWindow(307, 281, "Application 
Target");
     w = o;
     { fltk3::Input* o = new fltk3::Input(70, 20, 213, 25, "Name:");
       o->tooltip("name of the target - this will be used in the IDEs and as a 
general reference\

Modified: branches/branch-3.0/fluid/workspace_panel.fl
===================================================================
--- branches/branch-3.0/fluid/workspace_panel.fl        2011-07-28 12:20:33 UTC 
(rev 8875)
+++ branches/branch-3.0/fluid/workspace_panel.fl        2011-07-28 12:43:38 UTC 
(rev 8876)
@@ -29,6 +29,9 @@
 } {in_source in_header
 } 
 
+decl {\#include "Fl_Type.h"} {public global
+} 
+
 decl {\#include <fltk3/Pixmap.h>} {public global
 } 
 
@@ -53,7 +56,7 @@
   decl {enum { ENV_NONE=0, ENV_ALL=0x007f, ENV_ALL_SHELL=0x0003, 
ENV_MAKE=0x0001, ENV_CMAKE=0x0002, ENV_ALL_VC=0x001c, ENV_VC6=0x0004, 
ENV_VC2008=0x0008, ENV_VC2010=0x0010, ENV_ALL_XC=0x0060, ENV_XC3=0x0020, 
ENV_XC4=0x0040 };} {public local
   }
   {fltk3::MenuButton} pEnvMenu {
-    label Environent open
+    label Environent
     xywh {0 0 170 20} labelsize 12
   } {
     MenuItem pMenuAll {
@@ -111,7 +114,7 @@
   int n = strlen(buf);
   if (n>2) buf[n-2] = 0;
   pEnvList->copy_label(buf);
-}} selected
+}}
       xywh {0 0 100 20} labelsize 12 divider
     }
     Submenu {} {
@@ -213,84 +216,64 @@
     mi++;
   }
 }} {}
+  Function {value(unsigned int v)} {
+    comment {Set the environment flags} return_type void
+  } {
+    code {pEnv = v;
+cb_pMenuAll_i(0, 0);} {}
+  }
+  Function {value()} {
+    comment {Get the environment flags} return_type {unsigned int}
+  } {
+    code {return pEnv;} {}
+  }
 } 
 
 Function {show_workspace_panel()} {open
 } {
   codeblock {if (!workspace_panel)} {open
   } {
-    {fltk3::Window} workspace_panel {open
-      xywh {832 211 385 416} type Double visible
+    {fltk3::Window} workspace_panel {
+      label {Workspace Properties} open
+      xywh {832 211 274 173} type Double modal visible
     } {
-      {fltk3::Button} {} {
-        label OK
-        xywh {265 365 95 25} labelsize 12
-      }
-      {fltk3::Input} {} {
+      {fltk3::Input} pName {
         label {Name:}
-        tooltip {name of the target - this will be used in the IDEs and as a 
general reference.} xywh {85 15 213 25} labelsize 12 textsize 12
+        tooltip {name of the target - this will be used in the IDEs and as a 
general reference.} xywh {85 15 170 25} labelsize 12 textsize 12
       }
       {fltk3::Box} {} {
-        label Environments
-        xywh {10 49 362 2} box THIN_DOWN_FRAME labelsize 12 align 6
+        label {Create Build Enviroments for:}
+        xywh {10 50 288 2} box THIN_DOWN_FRAME labelsize 12 align 6
       }
-      {fltk3::CheckButton} {} {
-        label {Universal Command Line}
-        xywh {85 83 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::CheckButton} {} {
-        label {MS Windows (tm)}
-        xywh {85 143 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::CheckButton} {} {
-        label {VisualC 6 }
-        xywh {100 163 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::CheckButton} {} {
-        label {VisualC 2008}
-        xywh {100 183 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::CheckButton} {} {
-        label {VisualC 2010}
-        xywh {100 203 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::CheckButton} {} {
-        label {Apple OS X (tm)}
-        xywh {85 223 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::CheckButton} {} {
-        label {Xcode 3}
-        xywh {100 243 215 20} down_box DOWN_BOX labelsize 12 deactivate
-      }
-      {fltk3::CheckButton} {} {
-        label {Xcode 4}
-        xywh {100 263 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::CheckButton} {} {
-        label {Makefile (make, gmake)}
-        xywh {101 103 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::CheckButton} {} {
-        label {CMake File (cmake)}
-        xywh {101 123 215 20} down_box DOWN_BOX labelsize 12 deactivate
-      }
-      {fltk3::CheckButton} {} {
-        label {all supported Environments}
-        xywh {70 64 215 20} down_box DOWN_BOX labelsize 12
-      }
-      {fltk3::MenuButton} {} {open
-        xywh {85 295 170 40} box FLAT_BOX color 52
+      {fltk3::MenuButton} pEnv {open
+        xywh {85 71 170 40} box FLAT_BOX
         class Fl_Environment_Choice
       } {}
+      {fltk3::Button} {} {
+        label OK
+        callback {if (wks_name) free(wks_name);
+wks_name = strdup(pName->value());
+wks_env = pEnv->value();
+workspace_panel->hide();} selected
+        xywh {160 130 95 25} labelsize 12
+      }
     }
   }
-  code {workspace_panel->show();} {}
+  code {if (wks_name) 
+  pName->value(wks_name);
+else
+  pName->value("unnamed workspace");
+if (wks_env)  
+  pEnv->value(wks_env);  
+else
+  pEnv->value(Fl_Environment_Choice::ENV_ALL);
+workspace_panel->show();} {}
 } 
 
 Function {make_app_target_panel()} {open
 } {
   {fltk3::Window} {} {
-    label {Appliction Target} open
+    label {Application Target} open
     xywh {464 218 307 281} type Double visible
   } {
     {fltk3::Input} {} {

Modified: branches/branch-3.0/fluid/workspace_panel.h
===================================================================
--- branches/branch-3.0/fluid/workspace_panel.h 2011-07-28 12:20:33 UTC (rev 
8875)
+++ branches/branch-3.0/fluid/workspace_panel.h 2011-07-28 12:43:38 UTC (rev 
8876)
@@ -28,6 +28,7 @@
 #ifndef workspace_panel_h
 #define workspace_panel_h
 #include <fltk3/run.h>
+#include "Fl_Type.h"
 #include <fltk3/Pixmap.h>
 #include <fltk3/MultiLabel.h>
 extern fltk3::Pixmap menu_none_pixmap;
@@ -53,12 +54,15 @@
   static void cb_pMenuAll(fltk3::Menu_*, void*);
 public:
   fltk3::Box *pEnvList;
+  void value(unsigned int v);
+  unsigned int value();
 };
 #include <fltk3/DoubleWindow.h>
 extern fltk3::DoubleWindow *workspace_panel;
+#include <fltk3/Input.h>
+extern fltk3::Input *pName;
+extern Fl_Environment_Choice *pEnv;
 #include <fltk3/Button.h>
-#include <fltk3/Input.h>
-#include <fltk3/CheckButton.h>
 fltk3::DoubleWindow* show_workspace_panel();
 #include <fltk3/Choice.h>
 #include <fltk3/Output.h>

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to