فهرست منبع

wxGUI/vdigit: disable undo (fix first)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32546 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 16 سال پیش
والد
کامیت
69f6fcf6ff
2فایلهای تغییر یافته به همراه19 افزوده شده و 10 حذف شده
  1. 10 7
      gui/wxpython/gui_modules/toolbars.py
  2. 9 3
      raster/r.colors/main.c

+ 10 - 7
gui/wxpython/gui_modules/toolbars.py

@@ -627,13 +627,16 @@ class VDigitToolbar(AbstractToolbar):
 
 
         @param enable False for disable
         @param enable False for disable
         """
         """
-        if enable:
-            if self.toolbar[0].GetToolEnabled(self.undo) is False:
-                self.toolbar[0].EnableTool(self.undo, True)
-        else:
-            if self.toolbar[0].GetToolEnabled(self.undo) is True:
-                self.toolbar[0].EnableTool(self.undo, False)
-        
+        ### fix undo first...
+
+        #         if enable:
+        #             if self.toolbar[0].GetToolEnabled(self.undo) is False:
+        #                 self.toolbar[0].EnableTool(self.undo, True)
+        #         else:
+        #             if self.toolbar[0].GetToolEnabled(self.undo) is True:
+        #                 self.toolbar[0].EnableTool(self.undo, False)
+        pass
+
     def OnSettings(self, event):
     def OnSettings(self, event):
         """Show settings dialog"""
         """Show settings dialog"""
 
 

+ 9 - 3
raster/r.colors/main.c

@@ -109,6 +109,7 @@ int main(int argc, char **argv)
     char *style, *cmap, *cmapset;
     char *style, *cmap, *cmapset;
     char *rules;
     char *rules;
     int fp;
     int fp;
+    FILE *rules_file;
     struct GModule *module;
     struct GModule *module;
     struct
     struct
     {
     {
@@ -237,6 +238,7 @@ int main(int argc, char **argv)
     cmap = opt.rast->answer;
     cmap = opt.rast->answer;
     rules = opt.rules->answer;
     rules = opt.rules->answer;
 
 
+    rules_file = NULL;
     if (!name)
     if (!name)
 	G_fatal_error(_("No map specified"));
 	G_fatal_error(_("No map specified"));
 
 
@@ -244,11 +246,11 @@ int main(int argc, char **argv)
 	G_fatal_error(_
 	G_fatal_error(_
 		      ("One of \"-i\" or \"-r\" or options \"color\", \"rast\" or \"rules\" must be specified!"));
 		      ("One of \"-i\" or \"-r\" or options \"color\", \"rast\" or \"rules\" must be specified!"));
 
 
-    if (interactive && (style || rules || cmap))
+    if (interactive && ((strcmp(style, "rules") && rules) || cmap))
 	G_fatal_error(_
 	G_fatal_error(_
 		      ("Interactive mode is incompatible with \"color\", \"rules\", and \"raster\" options"));
 		      ("Interactive mode is incompatible with \"color\", \"rules\", and \"raster\" options"));
 
 
-    if ((style && (cmap || rules)) || (cmap && rules))
+    if ((strcmp(style, "rules") && (cmap || rules)) || (cmap && rules))
 	G_fatal_error(_
 	G_fatal_error(_
 		      ("\"color\", \"rules\", and \"raster\" options are mutually exclusive"));
 		      ("\"color\", \"rules\", and \"raster\" options are mutually exclusive"));
 
 
@@ -313,7 +315,11 @@ int main(int argc, char **argv)
 					(CELL) max);
 					(CELL) max);
 	}
 	}
 	else if (strcmp(style, "rules") == 0) {
 	else if (strcmp(style, "rules") == 0) {
-	    if (!read_color_rules(stdin, &colors, min, max, fp))
+	    rules_file = fopen(rules, "r");
+	    if (rules_file == NULL) {
+		G_fatal_error(_("Unable to open rules file <%s>"), rules);
+	    }
+	    if (!read_color_rules(rules_file, &colors, min, max, fp))
 		exit(EXIT_FAILURE);
 		exit(EXIT_FAILURE);
 	}
 	}
 	else if (find_rule(style))
 	else if (find_rule(style))