Patch #2825 2009-09-13 03:36

ir0nh34d

Astyle plugin incorrectly uses Linux style when GNU selected
Download
2825-Astyle_plugin.patch (2.9 KB)
Category
Plugin::Bugfix
Status
Accepted
Close date
2009-09-21 12:18
Assigned to
jenslody
Index: astyleconfigdlg.cpp
===================================================================
--- astyleconfigdlg.cpp    (revision 5765)
+++ astyleconfigdlg.cpp    (working copy)
@@ -33,8 +33,8 @@
   EVT_RADIOBUTTON(XRCID("rbStroustrup"), AstyleConfigDlg::OnStyleChange)
   EVT_RADIOBUTTON(XRCID("rbWhitesmith"), AstyleConfigDlg::OnStyleChange)
   EVT_RADIOBUTTON(XRCID("rbBanner"), AstyleConfigDlg::OnStyleChange)
+  EVT_RADIOBUTTON(XRCID("rbLinux"), AstyleConfigDlg::OnStyleChange)
   EVT_RADIOBUTTON(XRCID("rbGNU"), AstyleConfigDlg::OnStyleChange)
-  EVT_RADIOBUTTON(XRCID("rbLinux"), AstyleConfigDlg::OnStyleChange)
   EVT_RADIOBUTTON(XRCID("rbCustom"), AstyleConfigDlg::OnStyleChange)
   EVT_BUTTON(XRCID("Preview"), AstyleConfigDlg::OnPreview)
 END_EVENT_TABLE()
@@ -147,6 +147,20 @@
       XRCCTRL(*this, "rbBanner", wxRadioButton)->SetValue(true);
       break;
 #undef AS_BANNER
+#define AS_LINUX "\
+int Foo(bool isBar)\n\
+{\n\
+        if (isBar) {\n\
+                bar();\n\
+                return 1;\n\
+        } else\n\
+                return 0;\n\
+}"
+    case aspsLinux:
+      sample = _T(AS_LINUX);
+      XRCCTRL(*this, "rbLinux", wxRadioButton)->SetValue(true);
+      break;
+#undef AS_LINUX
 #define AS_GNU "\
 int Foo(bool isBar)\n\
 {\n\
@@ -163,20 +177,6 @@
       XRCCTRL(*this, "rbGNU", wxRadioButton)->SetValue(true);
       break;
 #undef AS_GNU
-#define AS_LINUX "\
-int Foo(bool isBar)\n\
-{\n\
-        if (isBar) {\n\
-                bar();\n\
-                return 1;\n\
-        } else\n\
-                return 0;\n\
-}"
-    case aspsLinux:
-      sample = _T(AS_LINUX);
-      XRCCTRL(*this, "rbLinux", wxRadioButton)->SetValue(true);
-      break;
-#undef AS_LINUX
     default:
       XRCCTRL(*this, "rbCustom", wxRadioButton)->SetValue(true);
       break;
@@ -230,10 +230,10 @@
     SetStyle(aspsWhitesmith);
   else if (event.GetId() == XRCID("rbBanner"))
     SetStyle(aspsBanner);
+  else if (event.GetId() == XRCID("rbLinux"))
+    SetStyle(aspsLinux);
   else if (event.GetId() == XRCID("rbGNU"))
     SetStyle(aspsGnu);
-  else if (event.GetId() == XRCID("rbLinux"))
-    SetStyle(aspsLinux);
   else if (event.GetId() == XRCID("rbCustom"))
     SetStyle(aspsCustom);
 }
@@ -319,9 +319,9 @@
     style = 4;
   else if (XRCCTRL(*this, "rbBanner", wxRadioButton)->GetValue())
     style = 5;
+  else if (XRCCTRL(*this, "rbLinux", wxRadioButton)->GetValue())
+    style = 6;
   else if (XRCCTRL(*this, "rbGNU", wxRadioButton)->GetValue())
-    style = 6;
-  else if (XRCCTRL(*this, "rbLinux", wxRadioButton)->GetValue())
     style = 7;
   else if (XRCCTRL(*this, "rbCustom", wxRadioButton)->GetValue())
     style = 8;
Index: astyleconfigdlg.h
===================================================================
--- astyleconfigdlg.h    (revision 5765)
+++ astyleconfigdlg.h    (working copy)
@@ -17,8 +17,8 @@
   aspsStroustrup,
   aspsWhitesmith,
   aspsBanner,
+  aspsLinux,
   aspsGnu,
-  aspsLinux,
   aspsCustom
 };
 
jenslody 2009-09-13 07:55

I'm working on this, (I also added another (new) style.

Your patch (in slightly modified form) will be committed soon.

jenslody 2009-09-21 12:18

committed in slightly modified form