]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/prop_picker.cxx
Fix line endings
[flightgear.git] / src / GUI / prop_picker.cxx
index aed464a4d348a3a40000b04e3f7dc76a23d190bc..a2b4de8519b9fdc9d5e4e6883a32a8ce6e59730c 100755 (executable)
 #  include <config.h>
 #endif
 
-#include "prop_picker.hxx"
-#include <Main/globals.hxx>
-
 #include <simgear/compiler.h>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include STL_STRING
+
+#include <Main/globals.hxx>
+#include "new_gui.hxx"
+#include "prop_picker.hxx"
+
 SG_USING_STD(string);
 
 // A local alternative name, for use when a variable called "string" is in scope - e.g. in classes derived from puInput.
@@ -344,10 +346,15 @@ fgPropPicker::~fgPropPicker ()
 */
 
 fgPropPicker::fgPropPicker ( int x, int y, int w, int h, int arrows,
-                                      const char *dir, const char *title ) : puDialogBox ( x,y )
+                                      const char *dir, const char *title ) :
+  fgPopup ( x,y ),
+  _gui((NewGUI *)globals->get_subsystem("gui"))
 {
   puFont LegendFont, LabelFont;
   puGetDefaultFonts ( &LegendFont, &LabelFont );
+  FGColor txtcol(_gui->getColor("label"));
+  txtcol.merge(_gui->getColor("text"));
+  txtcol.merge(_gui->getColor("text-label"));
 
   files = NULL ;
   num_files = 0 ;
@@ -364,6 +371,8 @@ fgPropPicker::fgPropPicker ( int x, int y, int w, int h, int arrows,
 
   proppath = new puText            (10, h-30);
   proppath ->    setLabel          (startDir);
+  proppath ->    setColor(PUCOL_LABEL, txtcol.red(), txtcol.green(),
+                          txtcol.blue(), txtcol.alpha());
 
   slider = new puSlider (w-30,40+20*arrows,h-100-40*arrows,TRUE,20);
   slider->setValue(1.0f);
@@ -375,6 +384,8 @@ fgPropPicker::fgPropPicker ( int x, int y, int w, int h, int arrows,
   list_box -> setUserData ( this ) ;
   list_box -> setCallback ( handle_select ) ;
   list_box -> setValue ( 0 ) ;
+  list_box -> setColor(PUCOL_LABEL, txtcol.red(), txtcol.green(),
+                       txtcol.blue(), txtcol.alpha());
 
   ok_button = new puOneShot ( 10, 10, (w<170)?(w/2-5):80, 30 ) ;
   ok_button -> setLegend ( "Ok" ) ;
@@ -445,11 +456,11 @@ void fgPropPicker::find_props ()
     files = new char* [ num_files+1 ] ;
 
     stdString line = ".";
-    files [ 0 ] = new char[line.size()];
+    files [ 0 ] = new char[line.size() + 1];
     strcpy ( files [ 0 ], line.c_str() );
 
     line = "..";
-    files [ 1 ] = new char[line.size()];
+    files [ 1 ] = new char[line.size() + 1];
     strcpy ( files [ 1 ], line.c_str() );
 
     pi = 2;
@@ -528,7 +539,7 @@ void fgPropPicker::updateTextForEntry(int index)
     if (dotFiles) index +=2;
                
     // don't leak everywhere if we're updating
-    if (files[index]) delete[] files[index];
+    delete[] files[index];
                
     files[index] = new char[ strlen(line.c_str())+2 ] ;
     strcpy ( files [ index ], line.c_str() ) ;
@@ -568,11 +579,15 @@ void fgPropEdit::fgPropEditHandleOK ( puObject* b )
   FG_POP_PUI_DIALOG( prop_edit );
 }
 
-fgPropEdit::fgPropEdit ( const char *name, const char *value, char *proppath ) : puDialogBox ( 0, 0 )
-
+fgPropEdit::fgPropEdit ( const char *name, const char *value, char *proppath ) :
+    fgPopup ( 0, 0 ),
+    _gui((NewGUI *)globals->get_subsystem("gui"))
 {
     puFont LegendFont, LabelFont;
     puGetDefaultFonts ( &LegendFont, &LabelFont );
+    FGColor txtcol(_gui->getColor("label"));
+    txtcol.merge(_gui->getColor("text"));
+    txtcol.merge(_gui->getColor("text-label"));
 
     // locate in relation to picker widget...
     int fx = PROPPICK_X;
@@ -585,6 +600,8 @@ fgPropEdit::fgPropEdit ( const char *name, const char *value, char *proppath ) :
 
     propname = new puText            (fx+10, fy+90);
     propname ->    setLabel          (name);
+    propname ->    setColor(PUCOL_LABEL, txtcol.red(), txtcol.green(),
+                            txtcol.blue(), txtcol.alpha());
         
     propinput   = new puInput           (fx+10, fy+50, fx+480, fy+80);
     propinput   ->    setValue          (value);