From eaba1ffa193104f90751371bfa9814552a2a6243 Mon Sep 17 00:00:00 2001 From: We-unite <3205135446@qq.com> Date: Wed, 19 Feb 2025 13:45:27 +0800 Subject: Init --- .gitignore | 8 + lib/TableLayout.jar | Bin 0 -> 112151 bytes lib/dom4j-2.0.3.jar | Bin 0 -> 313916 bytes lib/example/GridBagVersusTable$1.class | Bin 0 -> 551 bytes lib/example/GridBagVersusTable.class | Bin 0 -> 3490 bytes lib/example/GridBagVersusTable.java | 140 ++++ lib/example/GridVersusTable$1.class | Bin 0 -> 542 bytes lib/example/GridVersusTable.class | Bin 0 -> 2252 bytes lib/example/GridVersusTable.java | 112 +++ lib/example/MyClass$1.class | Bin 0 -> 518 bytes lib/example/MyClass.class | Bin 0 -> 1425 bytes lib/example/MyClass.java | 49 ++ lib/example/Preferred$1.class | Bin 0 -> 631 bytes lib/example/Preferred.class | Bin 0 -> 2744 bytes lib/example/Preferred.java | 106 +++ lib/example/RadTool$1.class | Bin 0 -> 621 bytes lib/example/RadTool$Box.class | Bin 0 -> 2183 bytes lib/example/RadTool$Smiley.class | Bin 0 -> 6148 bytes lib/example/RadTool.class | Bin 0 -> 9194 bytes lib/example/RadTool.java | 647 +++++++++++++++ lib/example/Simple$1.class | Bin 0 -> 515 bytes lib/example/Simple.class | Bin 0 -> 1648 bytes lib/example/Simple.java | 62 ++ lib/example/TypicalGui$1.class | Bin 0 -> 636 bytes lib/example/TypicalGui$ColorBox.class | Bin 0 -> 1255 bytes lib/example/TypicalGui.class | Bin 0 -> 4240 bytes lib/example/TypicalGui.java | 179 ++++ lib/hamcrest-core-1.3.jar | Bin 0 -> 45024 bytes lib/jcommon-1.0.16.jar | Bin 0 -> 309293 bytes lib/jfreechart-1.0.13.jar | Bin 0 -> 1425744 bytes lib/junit-4.13.jar | Bin 0 -> 381765 bytes lib/looks-2.1.4.jar | Bin 0 -> 409708 bytes src/control/images/Manual_confirmation_no.png | Bin 0 -> 363566 bytes src/control/images/Manual_confirmation_unknown.png | Bin 0 -> 363566 bytes src/control/images/Manual_confirmation_yes.png | Bin 0 -> 363566 bytes src/control/images/agree_no.gif | Bin 0 -> 576 bytes src/control/images/agree_ok.gif | Bin 0 -> 1030 bytes src/control/images/arrow_down.png | Bin 0 -> 1130 bytes src/control/images/arrow_left.png | Bin 0 -> 1175 bytes src/control/images/arrow_left_down.png | Bin 0 -> 1167 bytes src/control/images/arrow_left_up.png | Bin 0 -> 1455 bytes src/control/images/back1.jpg | Bin 0 -> 10992 bytes src/control/images/back2.jpg | Bin 0 -> 6813 bytes src/control/images/chartpanel/exportToImage.png | Bin 0 -> 723 bytes src/control/images/chartpanel/pan.png | Bin 0 -> 236 bytes src/control/images/chartpanel/zoomIn.png | Bin 0 -> 468 bytes src/control/images/chartpanel/zoomOut.png | Bin 0 -> 455 bytes src/control/images/chartpanel/zoomReset.png | Bin 0 -> 505 bytes src/control/images/chartpanel/zoomToOverview.png | Bin 0 -> 239 bytes src/control/images/email.png | Bin 0 -> 528 bytes src/control/images/exit.gif | Bin 0 -> 369 bytes src/control/images/gc.png | Bin 0 -> 554 bytes src/control/images/header_background.png | Bin 0 -> 175 bytes src/control/images/header_background_left.png | Bin 0 -> 185 bytes src/control/images/header_background_right.png | Bin 0 -> 186 bytes src/control/images/list_item_default_icon.png | Bin 0 -> 3282 bytes src/control/images/logo.png | Bin 0 -> 196 bytes src/control/images/logo1.png | Bin 0 -> 11020 bytes src/control/images/logo2.png | Bin 0 -> 14251 bytes src/control/images/menu_arrow.png | Bin 0 -> 153 bytes src/control/images/menubar_background.png | Bin 0 -> 208 bytes src/control/images/menubar_background_left.png | Bin 0 -> 219 bytes src/control/images/menubar_background_right.png | Bin 0 -> 215 bytes src/control/images/menubar_background_selected.png | Bin 0 -> 204 bytes src/control/images/module_node.png | Bin 0 -> 10161 bytes src/control/images/module_node_selected.png | Bin 0 -> 10262 bytes src/control/images/onError.gif | Bin 0 -> 633 bytes .../images/outlookPanel/module_selected.png | Bin 0 -> 3379 bytes .../images/outlookPanel/module_unselected.png | Bin 0 -> 352 bytes src/control/images/outlook_bar_background.png | Bin 0 -> 196 bytes .../images/outlook_bar_background_selected.png | Bin 0 -> 173 bytes .../outlook_bar_background_selected_left.png | Bin 0 -> 194 bytes .../outlook_bar_background_selected_right.png | Bin 0 -> 189 bytes src/control/images/outlook_bar_handler.png | Bin 0 -> 336 bytes .../images/outlook_bar_handler_selected.png | Bin 0 -> 306 bytes src/control/images/progress_select_background.png | Bin 0 -> 164 bytes src/control/images/progress_selected_left.png | Bin 0 -> 244 bytes src/control/images/progress_selected_right.png | Bin 0 -> 252 bytes .../images/progress_unselect_background.png | Bin 0 -> 172 bytes src/control/images/resize_handler.png | Bin 0 -> 2837 bytes src/control/images/separator_background.png | Bin 0 -> 115 bytes src/control/images/server.png | Bin 0 -> 290 bytes src/control/images/shrink_handler_left.png | Bin 0 -> 217 bytes src/control/images/shrink_handler_right.png | Bin 0 -> 219 bytes src/control/images/statusbar_background.png | Bin 0 -> 243 bytes src/control/images/statusbar_background_left.png | Bin 0 -> 239 bytes src/control/images/statusbar_background_right.png | Bin 0 -> 238 bytes .../images/statusbar_message_light_green.png | Bin 0 -> 282 bytes .../images/statusbar_message_light_orange.png | Bin 0 -> 288 bytes src/control/images/statusbar_message_light_red.png | Bin 0 -> 290 bytes src/control/images/statusbar_separator.png | Bin 0 -> 238 bytes src/control/images/submodule.png | Bin 0 -> 3268 bytes src/control/images/tab_close.png | Bin 0 -> 200 bytes src/control/images/tab_close_pressed.png | Bin 0 -> 2923 bytes src/control/images/tab_header_background.png | Bin 0 -> 193 bytes .../images/tab_header_selected_background_left.png | Bin 0 -> 181 bytes .../tab_header_selected_background_right.png | Bin 0 -> 187 bytes .../images/tab_header_unselected_background.png | Bin 0 -> 166 bytes .../tab_header_unselected_background_left.png | Bin 0 -> 269 bytes .../tab_header_unselected_background_right.png | Bin 0 -> 281 bytes src/control/images/textfield_background.png | Bin 0 -> 128 bytes src/control/images/textfield_background_left.png | Bin 0 -> 156 bytes src/control/images/textfield_background_right.png | Bin 0 -> 155 bytes src/control/images/toolbar/add.png | Bin 0 -> 2867 bytes src/control/images/toolbar/capture.png | Bin 0 -> 549 bytes src/control/images/toolbar/chart.png | Bin 0 -> 732 bytes src/control/images/toolbar/email.png | Bin 0 -> 528 bytes src/control/images/toolbar/home.png | Bin 0 -> 567 bytes src/control/images/toolbar/image_edit.png | Bin 0 -> 738 bytes src/control/images/toolbar/left.png | Bin 0 -> 385 bytes src/control/images/toolbar/message.png | Bin 0 -> 693 bytes src/control/images/toolbar/print.png | Bin 0 -> 2866 bytes src/control/images/toolbar/refresh.png | Bin 0 -> 2892 bytes src/control/images/toolbar/right.png | Bin 0 -> 454 bytes src/control/images/toolbar/update.png | Bin 0 -> 2876 bytes src/control/images/toolbar/user.png | Bin 0 -> 844 bytes src/control/images/toolbar/viewer.png | Bin 0 -> 609 bytes src/control/images/toolbar_background.png | Bin 0 -> 150 bytes src/control/images/toolbar_separator.png | Bin 0 -> 227 bytes src/cppcheckplus/control/Main.java | 917 +++++++++++++++++++++ src/cppcheckplus/control/MyContentPanel.java | 16 + src/cppcheckplus/control/MyContorlUtil.java | 597 ++++++++++++++ src/cppcheckplus/control/MyHeader.java | 201 +++++ src/cppcheckplus/control/MyList.java | 68 ++ src/cppcheckplus/control/MyListRenderer.java | 138 ++++ src/cppcheckplus/control/MyListSplitListener.java | 50 ++ src/cppcheckplus/control/MySeparator.java | 40 + src/cppcheckplus/control/MyTextField.java | 62 ++ src/cppcheckplus/control/MyToolbarButton.java | 96 +++ .../control/XChartletFullScreenListenter.java | 10 + src/cppcheckplus/control/menubar.xml | 32 + src/cppcheckplus/control/outlook.xml | 8 + src/cppcheckplus/control/settings.xml | 6 + src/cppcheckplus/control/shortcuts.xml | 17 + src/cppcheckplus/control/stdclang.xml | 17 + src/cppcheckplus/control/toolbar.xml | 17 + src/cppcheckplus/menu/MyMenu.java | 71 ++ src/cppcheckplus/menu/MyMenuBar.java | 56 ++ src/cppcheckplus/menu/MyMenuItem.java | 52 ++ src/cppcheckplus/menu/MyRootMenu.java | 62 ++ src/cppcheckplus/outlookpanel/MyOutlookBar.java | 223 +++++ src/cppcheckplus/outlookpanel/MyOutlookHeader.java | 109 +++ src/cppcheckplus/outlookpanel/MyOutlookList.java | 31 + .../outlookpanel/MyOutlookListPanel.java | 61 ++ .../outlookpanel/MyOutlookListRenderer.java | 54 ++ src/cppcheckplus/outlookpanel/MyOutlookPanel.java | 222 +++++ .../outlookpanel/MyOutlookPanelListItem.java | 51 ++ .../outlookpanel/MyOutlookSplitListener.java | 33 + src/cppcheckplus/shortcut/MyShortcutItem.java | 20 + .../shortcut/MyShortcutItemClickListenter.java | 7 + src/cppcheckplus/shortcut/MyShortcutPanel.java | 114 +++ src/cppcheckplus/shortcut/MyTree.java | 124 +++ src/cppcheckplus/tab/MyTabComponent.java | 173 ++++ src/cppcheckplus/tab/MyTabComponent1.java | 136 +++ src/cppcheckplus/tab/MyTabPage.java | 46 ++ src/cppcheckplus/tab/MyTabPage1.java | 30 + src/cppcheckplus/tab/MyTabPanel.java | 97 +++ src/cppcheckplus/tab/MyTabPanel1.java | 96 +++ src/cppcheckplus/tab/MyTabPanelUI.java | 53 ++ src/cppcheckplus/tab/MyTabPanelUI1.java | 53 ++ src/cppcheckplus/text/DeflectRow.java | 126 +++ src/cppcheckplus/text/FileTools.java | 84 ++ src/cppcheckplus/text/LineNumberHeaderView.java | 80 ++ src/cppcheckplus/text/MyButtonEditor.java | 88 ++ src/cppcheckplus/text/MyButtonRenderer.java | 62 ++ src/cppcheckplus/text/MyPanel.java | 31 + src/cppcheckplus/text/MyTextArea.java | 60 ++ src/cppcheckplus/text/MyTextPanel.java | 72 ++ src/cppcheckplus/text/MyTextPanel1.java | 58 ++ src/cppcheckplus/text/ViewPanel.java | 213 +++++ src/cppcheckplus/text/creatTable.java | 321 ++++++++ src/cppcheckplus/text/stdClangType.java | 9 + src/cppcheckplus/toolbar/MyToolBar.java | 60 ++ src/cppcheckplus/toolbar/MyToolBarButton.java | 97 +++ src/cppcheckplus/toolbar/MyToolBarRoverButton.java | 36 + 175 files changed, 6966 insertions(+) create mode 100644 .gitignore create mode 100644 lib/TableLayout.jar create mode 100644 lib/dom4j-2.0.3.jar create mode 100644 lib/example/GridBagVersusTable$1.class create mode 100644 lib/example/GridBagVersusTable.class create mode 100644 lib/example/GridBagVersusTable.java create mode 100644 lib/example/GridVersusTable$1.class create mode 100644 lib/example/GridVersusTable.class create mode 100644 lib/example/GridVersusTable.java create mode 100644 lib/example/MyClass$1.class create mode 100644 lib/example/MyClass.class create mode 100644 lib/example/MyClass.java create mode 100644 lib/example/Preferred$1.class create mode 100644 lib/example/Preferred.class create mode 100644 lib/example/Preferred.java create mode 100644 lib/example/RadTool$1.class create mode 100644 lib/example/RadTool$Box.class create mode 100644 lib/example/RadTool$Smiley.class create mode 100644 lib/example/RadTool.class create mode 100644 lib/example/RadTool.java create mode 100644 lib/example/Simple$1.class create mode 100644 lib/example/Simple.class create mode 100644 lib/example/Simple.java create mode 100644 lib/example/TypicalGui$1.class create mode 100644 lib/example/TypicalGui$ColorBox.class create mode 100644 lib/example/TypicalGui.class create mode 100644 lib/example/TypicalGui.java create mode 100644 lib/hamcrest-core-1.3.jar create mode 100644 lib/jcommon-1.0.16.jar create mode 100644 lib/jfreechart-1.0.13.jar create mode 100644 lib/junit-4.13.jar create mode 100644 lib/looks-2.1.4.jar create mode 100644 src/control/images/Manual_confirmation_no.png create mode 100644 src/control/images/Manual_confirmation_unknown.png create mode 100644 src/control/images/Manual_confirmation_yes.png create mode 100644 src/control/images/agree_no.gif create mode 100644 src/control/images/agree_ok.gif create mode 100644 src/control/images/arrow_down.png create mode 100644 src/control/images/arrow_left.png create mode 100644 src/control/images/arrow_left_down.png create mode 100644 src/control/images/arrow_left_up.png create mode 100644 src/control/images/back1.jpg create mode 100644 src/control/images/back2.jpg create mode 100644 src/control/images/chartpanel/exportToImage.png create mode 100644 src/control/images/chartpanel/pan.png create mode 100644 src/control/images/chartpanel/zoomIn.png create mode 100644 src/control/images/chartpanel/zoomOut.png create mode 100644 src/control/images/chartpanel/zoomReset.png create mode 100644 src/control/images/chartpanel/zoomToOverview.png create mode 100644 src/control/images/email.png create mode 100644 src/control/images/exit.gif create mode 100644 src/control/images/gc.png create mode 100644 src/control/images/header_background.png create mode 100644 src/control/images/header_background_left.png create mode 100644 src/control/images/header_background_right.png create mode 100644 src/control/images/list_item_default_icon.png create mode 100644 src/control/images/logo.png create mode 100644 src/control/images/logo1.png create mode 100644 src/control/images/logo2.png create mode 100644 src/control/images/menu_arrow.png create mode 100644 src/control/images/menubar_background.png create mode 100644 src/control/images/menubar_background_left.png create mode 100644 src/control/images/menubar_background_right.png create mode 100644 src/control/images/menubar_background_selected.png create mode 100644 src/control/images/module_node.png create mode 100644 src/control/images/module_node_selected.png create mode 100644 src/control/images/onError.gif create mode 100644 src/control/images/outlookPanel/module_selected.png create mode 100644 src/control/images/outlookPanel/module_unselected.png create mode 100644 src/control/images/outlook_bar_background.png create mode 100644 src/control/images/outlook_bar_background_selected.png create mode 100644 src/control/images/outlook_bar_background_selected_left.png create mode 100644 src/control/images/outlook_bar_background_selected_right.png create mode 100644 src/control/images/outlook_bar_handler.png create mode 100644 src/control/images/outlook_bar_handler_selected.png create mode 100644 src/control/images/progress_select_background.png create mode 100644 src/control/images/progress_selected_left.png create mode 100644 src/control/images/progress_selected_right.png create mode 100644 src/control/images/progress_unselect_background.png create mode 100644 src/control/images/resize_handler.png create mode 100644 src/control/images/separator_background.png create mode 100644 src/control/images/server.png create mode 100644 src/control/images/shrink_handler_left.png create mode 100644 src/control/images/shrink_handler_right.png create mode 100644 src/control/images/statusbar_background.png create mode 100644 src/control/images/statusbar_background_left.png create mode 100644 src/control/images/statusbar_background_right.png create mode 100644 src/control/images/statusbar_message_light_green.png create mode 100644 src/control/images/statusbar_message_light_orange.png create mode 100644 src/control/images/statusbar_message_light_red.png create mode 100644 src/control/images/statusbar_separator.png create mode 100644 src/control/images/submodule.png create mode 100644 src/control/images/tab_close.png create mode 100644 src/control/images/tab_close_pressed.png create mode 100644 src/control/images/tab_header_background.png create mode 100644 src/control/images/tab_header_selected_background_left.png create mode 100644 src/control/images/tab_header_selected_background_right.png create mode 100644 src/control/images/tab_header_unselected_background.png create mode 100644 src/control/images/tab_header_unselected_background_left.png create mode 100644 src/control/images/tab_header_unselected_background_right.png create mode 100644 src/control/images/textfield_background.png create mode 100644 src/control/images/textfield_background_left.png create mode 100644 src/control/images/textfield_background_right.png create mode 100644 src/control/images/toolbar/add.png create mode 100644 src/control/images/toolbar/capture.png create mode 100644 src/control/images/toolbar/chart.png create mode 100644 src/control/images/toolbar/email.png create mode 100644 src/control/images/toolbar/home.png create mode 100644 src/control/images/toolbar/image_edit.png create mode 100644 src/control/images/toolbar/left.png create mode 100644 src/control/images/toolbar/message.png create mode 100644 src/control/images/toolbar/print.png create mode 100644 src/control/images/toolbar/refresh.png create mode 100644 src/control/images/toolbar/right.png create mode 100644 src/control/images/toolbar/update.png create mode 100644 src/control/images/toolbar/user.png create mode 100644 src/control/images/toolbar/viewer.png create mode 100644 src/control/images/toolbar_background.png create mode 100644 src/control/images/toolbar_separator.png create mode 100644 src/cppcheckplus/control/Main.java create mode 100644 src/cppcheckplus/control/MyContentPanel.java create mode 100644 src/cppcheckplus/control/MyContorlUtil.java create mode 100644 src/cppcheckplus/control/MyHeader.java create mode 100644 src/cppcheckplus/control/MyList.java create mode 100644 src/cppcheckplus/control/MyListRenderer.java create mode 100644 src/cppcheckplus/control/MyListSplitListener.java create mode 100644 src/cppcheckplus/control/MySeparator.java create mode 100644 src/cppcheckplus/control/MyTextField.java create mode 100644 src/cppcheckplus/control/MyToolbarButton.java create mode 100644 src/cppcheckplus/control/XChartletFullScreenListenter.java create mode 100644 src/cppcheckplus/control/menubar.xml create mode 100644 src/cppcheckplus/control/outlook.xml create mode 100644 src/cppcheckplus/control/settings.xml create mode 100644 src/cppcheckplus/control/shortcuts.xml create mode 100644 src/cppcheckplus/control/stdclang.xml create mode 100644 src/cppcheckplus/control/toolbar.xml create mode 100644 src/cppcheckplus/menu/MyMenu.java create mode 100644 src/cppcheckplus/menu/MyMenuBar.java create mode 100644 src/cppcheckplus/menu/MyMenuItem.java create mode 100644 src/cppcheckplus/menu/MyRootMenu.java create mode 100644 src/cppcheckplus/outlookpanel/MyOutlookBar.java create mode 100644 src/cppcheckplus/outlookpanel/MyOutlookHeader.java create mode 100644 src/cppcheckplus/outlookpanel/MyOutlookList.java create mode 100644 src/cppcheckplus/outlookpanel/MyOutlookListPanel.java create mode 100644 src/cppcheckplus/outlookpanel/MyOutlookListRenderer.java create mode 100644 src/cppcheckplus/outlookpanel/MyOutlookPanel.java create mode 100644 src/cppcheckplus/outlookpanel/MyOutlookPanelListItem.java create mode 100644 src/cppcheckplus/outlookpanel/MyOutlookSplitListener.java create mode 100644 src/cppcheckplus/shortcut/MyShortcutItem.java create mode 100644 src/cppcheckplus/shortcut/MyShortcutItemClickListenter.java create mode 100644 src/cppcheckplus/shortcut/MyShortcutPanel.java create mode 100644 src/cppcheckplus/shortcut/MyTree.java create mode 100644 src/cppcheckplus/tab/MyTabComponent.java create mode 100644 src/cppcheckplus/tab/MyTabComponent1.java create mode 100644 src/cppcheckplus/tab/MyTabPage.java create mode 100644 src/cppcheckplus/tab/MyTabPage1.java create mode 100644 src/cppcheckplus/tab/MyTabPanel.java create mode 100644 src/cppcheckplus/tab/MyTabPanel1.java create mode 100644 src/cppcheckplus/tab/MyTabPanelUI.java create mode 100644 src/cppcheckplus/tab/MyTabPanelUI1.java create mode 100644 src/cppcheckplus/text/DeflectRow.java create mode 100644 src/cppcheckplus/text/FileTools.java create mode 100644 src/cppcheckplus/text/LineNumberHeaderView.java create mode 100644 src/cppcheckplus/text/MyButtonEditor.java create mode 100644 src/cppcheckplus/text/MyButtonRenderer.java create mode 100644 src/cppcheckplus/text/MyPanel.java create mode 100644 src/cppcheckplus/text/MyTextArea.java create mode 100644 src/cppcheckplus/text/MyTextPanel.java create mode 100644 src/cppcheckplus/text/MyTextPanel1.java create mode 100644 src/cppcheckplus/text/ViewPanel.java create mode 100644 src/cppcheckplus/text/creatTable.java create mode 100644 src/cppcheckplus/text/stdClangType.java create mode 100644 src/cppcheckplus/toolbar/MyToolBar.java create mode 100644 src/cppcheckplus/toolbar/MyToolBarButton.java create mode 100644 src/cppcheckplus/toolbar/MyToolBarRoverButton.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d6b8a8b --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.idea/* +bin/ +web/ +.classpath +.project +.settings/ +target/ +*.iml diff --git a/lib/TableLayout.jar b/lib/TableLayout.jar new file mode 100644 index 0000000..23519b0 Binary files /dev/null and b/lib/TableLayout.jar differ diff --git a/lib/dom4j-2.0.3.jar b/lib/dom4j-2.0.3.jar new file mode 100644 index 0000000..1ef5c52 Binary files /dev/null and b/lib/dom4j-2.0.3.jar differ diff --git a/lib/example/GridBagVersusTable$1.class b/lib/example/GridBagVersusTable$1.class new file mode 100644 index 0000000..78bc1c2 Binary files /dev/null and b/lib/example/GridBagVersusTable$1.class differ diff --git a/lib/example/GridBagVersusTable.class b/lib/example/GridBagVersusTable.class new file mode 100644 index 0000000..52ee8f7 Binary files /dev/null and b/lib/example/GridBagVersusTable.class differ diff --git a/lib/example/GridBagVersusTable.java b/lib/example/GridBagVersusTable.java new file mode 100644 index 0000000..53e45d6 --- /dev/null +++ b/lib/example/GridBagVersusTable.java @@ -0,0 +1,140 @@ +package example; + + + +import java.awt.*; +import java.awt.event.*; +import javax.swing.JButton; +import layout.TableLayout; +import layout.TableLayoutConstraints; + + + +public class GridBagVersusTable +{ + + + + protected static void makeButton + (Frame frame, String name, GridBagLayout gridbag, GridBagConstraints c) + { + JButton button = new JButton(name); + gridbag.setConstraints(button, c); + frame.add(button); + } + + + + protected static Frame showGridBagWindow () + { + // Create layout and contraints object + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints c = new GridBagConstraints(); + + // Create frame + Frame frame = new Frame("GridBagLayout"); + frame.setFont (new Font("Helvetica", Font.PLAIN, 14)); + frame.setLayout (gridbag); + + // Create buttons, add buttons, and apply constraints + c.fill = GridBagConstraints.BOTH; + c.weightx = 1.0; + makeButton (frame, "Button1", gridbag, c); + makeButton (frame, "Button2", gridbag, c); + makeButton (frame, "Button3", gridbag, c); + + c.gridwidth = GridBagConstraints.REMAINDER; //end of row + makeButton (frame, "Button4", gridbag, c); + + c.weightx = 0.0; //reset to the default + makeButton (frame, "Button5", gridbag, c); //another row + + c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last in row + makeButton (frame, "Button6", gridbag, c); + + c.gridwidth = GridBagConstraints.REMAINDER; //end of row + makeButton (frame, "Button7", gridbag, c); + + c.gridwidth = 1; //reset to the default + c.gridheight = 2; + c.weighty = 1.0; + makeButton (frame, "Button8", gridbag, c); + + c.weighty = 0.0; //reset to the default + c.gridwidth = GridBagConstraints.REMAINDER; //end of row + c.gridheight = 1; //reset to the default + makeButton (frame, "Button9", gridbag, c); + makeButton (frame, "Button10", gridbag, c); + + // Show frame + frame.pack(); + frame.setLocation (0, 10); + frame.show(); + + return frame; + } + + + + protected static Frame showTableWindow () + { + // Create frame + Frame frame = new Frame("TableLayout"); + frame.setFont(new Font("Helvetica", Font.PLAIN, 14)); + + // Set layout + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double size[][] = {{f, f, f, f}, {p, p, p, p, f}}; + + TableLayout layout = new TableLayout(size); + frame.setLayout (layout); + + // Create buttons labeled Button1 to Button10 + int numButton = 10; + JButton button[] = new JButton[numButton + 1]; + + for (int i = 1; i <= numButton; i++) + button[i] = new JButton("Button" + i); + + // Add buttons + frame.add (button[1], "0, 0"); + frame.add (button[2], "1, 0"); + frame.add (button[3], "2, 0"); + frame.add (button[4], "3, 0"); + frame.add (button[5], "0, 1, 3, 1"); + frame.add (button[6], "0, 2, 2, 2"); + frame.add (button[7], "3, 2, 3, 2"); + frame.add (button[8], "0, 3, 0, 4"); + frame.add (button[9], "1, 3, 3, 3"); + frame.add (button[10], "1, 4, 3, 4"); + + // Show frame + frame.pack(); + frame.setLocation (400, 10); + frame.show(); + + return frame; + } + + + + public static void main (String args[]) + { + WindowListener listener = + (new WindowAdapter() + { + public void windowClosing (WindowEvent e) + { + System.exit (0); + } + } + ); + + Frame frame = showGridBagWindow(); + frame.addWindowListener (listener); + + frame = showTableWindow(); + frame.addWindowListener (listener); + } +} diff --git a/lib/example/GridVersusTable$1.class b/lib/example/GridVersusTable$1.class new file mode 100644 index 0000000..0acce1a Binary files /dev/null and b/lib/example/GridVersusTable$1.class differ diff --git a/lib/example/GridVersusTable.class b/lib/example/GridVersusTable.class new file mode 100644 index 0000000..ea2dbbe Binary files /dev/null and b/lib/example/GridVersusTable.class differ diff --git a/lib/example/GridVersusTable.java b/lib/example/GridVersusTable.java new file mode 100644 index 0000000..c5746c4 --- /dev/null +++ b/lib/example/GridVersusTable.java @@ -0,0 +1,112 @@ +package example; + + + +import java.awt.*; +import java.awt.event.*; +import javax.swing.JButton; +import layout.TableLayout; + + + +public class GridVersusTable { + + + + protected static Frame showGridWindow () + { + // Create frame + Frame frame = new Frame("GridLayout"); + frame.setFont (new Font("Helvetica", Font.PLAIN, 14)); + frame.setLayout (new GridLayout(2, 0)); + + // Create and add buttons + frame.add (new JButton("One")); + frame.add (new JButton("Two")); + frame.add (new JButton("Three")); + frame.add (new JButton("Four")); + + // Show frame + frame.pack(); + frame.setLocation (0, 10); + frame.show(); + + return frame; + } + + + + protected static Frame showTableWindow () + { + // Create frame + Frame frame = new Frame("TableLayout"); + frame.setFont (new Font("Helvetica", Font.PLAIN, 14)); + + // Set layout + double f = TableLayout.FILL; + double size[][] = {{f, f}, {f, f}}; + frame.setLayout (new TableLayout(size)); + + // Create and add buttons + frame.add (new JButton("One"), "0, 0"); + frame.add (new JButton("Two"), "1, 0"); + frame.add (new JButton("Three"), "0, 1"); + frame.add (new JButton("Four"), "1, 1"); + + // Show frame + frame.pack(); + frame.setLocation (200, 10); + frame.show(); + + return frame; + } + + + + protected static Frame showTableWindow2 () + { + // Create frame + Frame frame = new Frame("TableLayout"); + frame.setFont (new Font("Helvetica", Font.PLAIN, 14)); + + // Set layout + double f = TableLayout.FILL; + double size[][] = {{f, f}, {f, f}}; + frame.setLayout (new TableLayout(size)); + + // Create and add buttons + frame.add (new JButton("One"), "0, 0"); + frame.add (new JButton("Two"), "1, 1"); + + // Show frame + frame.pack(); + frame.setLocation (400, 10); + frame.show(); + + return frame; + } + + + + public static void main (String args[]) + { + WindowListener listener = + (new WindowAdapter() + { + public void windowClosing (WindowEvent e) + { + System.exit (0); + } + } + ); + + Frame frame = showGridWindow(); + frame.addWindowListener(listener); + + frame = showTableWindow(); + frame.addWindowListener(listener); + + frame = showTableWindow2(); + frame.addWindowListener(listener); + } +} diff --git a/lib/example/MyClass$1.class b/lib/example/MyClass$1.class new file mode 100644 index 0000000..d221d3f Binary files /dev/null and b/lib/example/MyClass$1.class differ diff --git a/lib/example/MyClass.class b/lib/example/MyClass.class new file mode 100644 index 0000000..0ff16c4 Binary files /dev/null and b/lib/example/MyClass.class differ diff --git a/lib/example/MyClass.java b/lib/example/MyClass.java new file mode 100644 index 0000000..632e99a --- /dev/null +++ b/lib/example/MyClass.java @@ -0,0 +1,49 @@ +package example; + + + +import java.awt.*; +import java.awt.event.*; +import layout.TableLayout; + +public class MyClass +{ + + public static void main (String args[]) + { + Frame frame = new Frame("MyTitle"); + frame.setBounds (100, 100, 300, 300); + + double size[][] = + {{-2.0, 10.0, 50.0, -1.0, 10.0}, // Columns + {-2.0, 10.0, 0.25, -1.0, 10.0}}; // Rows + + frame.setLayout (new TableLayout(size)); + + Button button; + button = new Button("3, 3, R, C"); + frame.add (button, "3, 3, R, C"); + button = new Button("3, 3, L, T"); + frame.add (button, "3, 3, L, T"); + button = new Button("2, 3, C, T"); + frame.add (button, "2, 3, C, T"); + button = new Button("3, 2, L, C"); + frame.add (button, "3, 2, L, C"); + button = new Button("2, 2, F, F"); + frame.add (button, "2, 2, F, F"); + button = new Button("3, 3, C, C"); + frame.add (button, "3, 3, C, C"); + + frame.addWindowListener + (new WindowAdapter() + { + public void windowClosing (WindowEvent e) + { + System.exit (0); + } + } + ); + + frame.show(); + } +} diff --git a/lib/example/Preferred$1.class b/lib/example/Preferred$1.class new file mode 100644 index 0000000..2501341 Binary files /dev/null and b/lib/example/Preferred$1.class differ diff --git a/lib/example/Preferred.class b/lib/example/Preferred.class new file mode 100644 index 0000000..221d384 Binary files /dev/null and b/lib/example/Preferred.class differ diff --git a/lib/example/Preferred.java b/lib/example/Preferred.java new file mode 100644 index 0000000..aa1e8a6 --- /dev/null +++ b/lib/example/Preferred.java @@ -0,0 +1,106 @@ +package example; + + + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import layout.TableLayout; + + + +public class Preferred extends JFrame +{ + + + + public static void main (String args[]) + { + new Preferred(); + } + + + + public Preferred () + { + super ("The Power of Preferred Sizes"); + + Container pane = getContentPane(); + + // b - border + // f - FILL + // p - PREFERRED + // vs - vertical space between labels and text fields + // vg - vertical gap between form elements + // hg - horizontal gap between form elements + + double b = 10; + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double vs = 5; + double vg = 10; + double hg = 10; + + double size[][] = + {{b, f, hg, p, hg, p, b}, + {b, p, vs, p, vg, p, vs, p, vg, p, vs, p, vg, p, b}}; + + TableLayout layout = new TableLayout(size); + pane.setLayout (layout); + + // Create all controls + JLabel labelName = new JLabel("Name"); + JLabel labelAddress = new JLabel("Address"); + JLabel labelCity = new JLabel("City"); + JLabel labelState = new JLabel("State"); + JLabel labelZip = new JLabel("Zip"); + + JTextField textfieldName = new JTextField(10); + JTextField textfieldAddress = new JTextField(20); + JTextField textfieldCity = new JTextField(10); + JTextField textfieldState = new JTextField(2); + JTextField textfieldZip = new JTextField(5); + + JButton buttonOk = new JButton("OK"); + JButton buttonCancel = new JButton("Cancel"); + JPanel panelButton = new JPanel(); + panelButton.add (buttonOk); + panelButton.add (buttonCancel); + + // Add all controls + pane.add (labelName, "1, 1, 5, 1"); + pane.add (textfieldName, "1, 3, 5, 3"); + pane.add (labelAddress, "1, 5, 5, 5"); + pane.add (textfieldAddress, "1, 7, 5, 7"); + pane.add (labelCity, "1, 9"); + pane.add (textfieldCity, "1, 11"); + pane.add (labelState, "3, 9"); + pane.add (textfieldState, "3, 11"); + pane.add (labelZip, "5, 9"); + pane.add (textfieldZip, "5, 11"); + pane.add (panelButton, "1, 13, 5, 13"); + + allowClosing(); + pack(); + setResizable (false); + show(); + } + + + + public void allowClosing () + { + addWindowListener + (new WindowAdapter() + { + public void windowClosing (WindowEvent e) + { + System.exit (0); + } + } + ); + } + + + +} diff --git a/lib/example/RadTool$1.class b/lib/example/RadTool$1.class new file mode 100644 index 0000000..5701874 Binary files /dev/null and b/lib/example/RadTool$1.class differ diff --git a/lib/example/RadTool$Box.class b/lib/example/RadTool$Box.class new file mode 100644 index 0000000..4ca3197 Binary files /dev/null and b/lib/example/RadTool$Box.class differ diff --git a/lib/example/RadTool$Smiley.class b/lib/example/RadTool$Smiley.class new file mode 100644 index 0000000..2796ed6 Binary files /dev/null and b/lib/example/RadTool$Smiley.class differ diff --git a/lib/example/RadTool.class b/lib/example/RadTool.class new file mode 100644 index 0000000..cc59d1f Binary files /dev/null and b/lib/example/RadTool.class differ diff --git a/lib/example/RadTool.java b/lib/example/RadTool.java new file mode 100644 index 0000000..8ef0c55 --- /dev/null +++ b/lib/example/RadTool.java @@ -0,0 +1,647 @@ +package example; + + + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import layout.TableLayout; +import layout.TableLayoutConstraints; +import support.GeneralDialog; + + + +public class RadTool extends Frame implements ActionListener +{ + + + + private JTextField textfieldColumnNumber; + private JTextField textfieldColumnSize; + private JTextField textfieldRowNumber; + private JTextField textfieldRowSize; + private JButton buttonAddColumn; + private JButton buttonRemoveColumn; + private JButton buttonResizeColumn; + private JButton buttonAddRow; + private JButton buttonRemoveRow; + private JButton buttonResizeRow; + private JButton buttonShowLayout; + private JButton buttonGenerateCode; + private TextArea textArea; + private JPanel panel; + private TableLayout layout; + private ArrayList columnHeader; + private ArrayList rowHeader; + private ArrayList boxList; + + + + public static void main (String args[]) + { + new RadTool(); + } + + + + /** + * Constructs the user interface. + */ + + public RadTool() + { + // Create frame + super("Example of Dynamic Rows and Columns"); + + // Create a TableLayout for the frame + double b = 10; + double s = 5; + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double size[][] = + {{b, p, s, p, s, p, s, p, s, p, s, p, s, p, f, b}, + {f, s, p, s, p, s, 100, s, p, b}}; + + setLayout (new TableLayout(size)); + + // Create static controls + JLabel labelColumn = new JLabel("Column"); + JLabel labelColumnSize = new JLabel("Size"); + textfieldColumnNumber = new JTextField(2); + textfieldColumnSize = new JTextField(2); + buttonAddColumn = new JButton("Add"); + buttonRemoveColumn = new JButton("Remove"); + buttonResizeColumn = new JButton("Resize"); + + JLabel labelRow = new JLabel("Row"); + JLabel labelRowSize = new JLabel("Size"); + textfieldRowNumber = new JTextField(2); + textfieldRowSize = new JTextField(5); + buttonAddRow = new JButton("Add"); + buttonRemoveRow = new JButton("Remove"); + buttonResizeRow = new JButton("Resize"); + + textArea = new TextArea(); + columnHeader = new ArrayList(); + rowHeader = new ArrayList(); + boxList = new ArrayList(); + buttonShowLayout = new JButton("Show Layout"); + buttonGenerateCode = new JButton("Generate Code"); + + // Add static controls + add (labelColumn, " 1, 2"); + add (textfieldColumnNumber, " 3, 2"); + add (labelColumnSize, " 5, 2"); + add (textfieldColumnSize, " 7, 2"); + add (buttonAddColumn, " 9, 2"); + add (buttonRemoveColumn, "11, 2"); + add (buttonResizeColumn, "13, 2"); + + add (labelRow, " 1, 4"); + add (textfieldRowNumber, " 3, 4"); + add (labelRowSize, " 5, 4"); + add (textfieldRowSize, " 7, 4"); + add (buttonAddRow, " 9, 4"); + add (buttonRemoveRow, "11, 4"); + add (buttonResizeRow, "13, 4"); + + add (textArea, "1, 6, 14, 6"); + add (buttonShowLayout, "1, 8, 7, 6"); + add (buttonGenerateCode, "9, 8, 12, 8"); + + // Listen for button events + buttonAddColumn.addActionListener (this); + buttonRemoveColumn.addActionListener (this); + buttonResizeColumn.addActionListener (this); + buttonAddRow.addActionListener (this); + buttonRemoveRow.addActionListener (this); + buttonResizeRow.addActionListener (this); + buttonShowLayout.addActionListener (this); + buttonGenerateCode.addActionListener (this); + + // Add a panel for RadTool controls + panel = new JPanel(); + panel.setBackground (Color.white); + add (panel, "0, 0, 15, 0"); + + // Create the layout manager for the panel + double size2[][] = {{p, -1}, {p, -1}}; + layout = new TableLayout(size2); + panel.setLayout (layout); + updateHeader(); + updateBox(); + + // Allow user to close the window to terminate the program + addWindowListener + (new WindowAdapter() + { + public void windowClosing (WindowEvent e) + { + System.exit (0); + } + } + ); + + // Show frame + setBackground (Color.lightGray); + setBounds (100, 100, 500, 400); + show(); + } + + + + /** + * Handles all action events. + */ + + public void actionPerformed (ActionEvent e) + { + // Get row and column information from text fields + int row = getInt(textfieldRowNumber); + int col = getInt(textfieldColumnNumber); + double rowSize = getDouble(textfieldRowSize); + double colSize = getDouble(textfieldColumnSize); + + // Get source of the event + Object source = e.getSource(); + + try + { + // Update layout + if (source == buttonAddColumn) + layout.insertColumn (col, colSize); + else if (source == buttonRemoveColumn) + layout.deleteColumn (col); + else if (source == buttonResizeColumn) + layout.setColumn (col, colSize); + else if (source == buttonAddRow) + layout.insertRow (row, rowSize); + else if (source == buttonRemoveRow) + layout.deleteRow (row); + else if (source == buttonResizeRow) + layout.setRow (row, rowSize); + + // Update headers, etc. to reflect layout's change + updateHeader(); + updateBox(); + + // Layout and repaint panel since the layout has changed + panel.doLayout(); + panel.repaint(); + + // Update layout's description + textArea.setText(layout.toString()); + + // Generate code if desired + if (source == buttonGenerateCode) + generateCode(); + } + catch (Throwable error) + { + error.printStackTrace(); + textArea.setText (error.toString()); + } + } + + + + /** + * Converts the text in a text field to an integer. + */ + + private int getInt (JTextField field) + { + int value = 0; + + try + { + value = Integer.parseInt(field.getText()); + } + catch (NumberFormatException e) {} + + return value; + } + + + + /** + * Converts the text in a text field to a double. + */ + + private double getDouble (JTextField field) + { + double value = -1.0; + + try + { + value = Double.parseDouble(field.getText()); + } + catch (NumberFormatException e) {} + + return value; + } + + + + /** + * Updates all the row and columns headers by bruce force. The headers + * are removed and then recreated based on the current layout configuration. + */ + + private void updateHeader () + { + TableLayoutConstraints c = new TableLayoutConstraints + (0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL); + + double size[] = layout.getColumn(); + + for (int i = columnHeader.size() - 1; i >= 0; i--) + { + JButton header = (JButton) columnHeader.remove(i); + panel.remove(header); + } + + for (int i = 0; i < size.length; i++) + { + c.col1 = c.col2 = i; + JButton header = new JButton("" + i + ": " + size[i]); + columnHeader.add(i, header); + panel.add (header, c); + } + + c.col1 = c.col2 = 0; + size = layout.getRow(); + + for (int i = rowHeader.size() - 1; i >= 0; i--) + { + JButton header = (JButton) rowHeader.remove(i); + panel.remove(header); + } + + for (int i = 0; i < size.length; i++) + { + c.row1 = c.row2 = i; + JButton header = new JButton("" + i + ": " + size[i]); + rowHeader.add(i, header); + panel.add (header, c); + } + } + + + + /** + * Updates the boxes used to illustrate cells. This is a brute force, + * unoptimized method. + */ + + private void updateBox () + { + for (int i = boxList.size() - 1; i >= 0; i--) + { + Box box = (Box) boxList.remove(i); + panel.remove(box); + } + + TableLayoutConstraints constraint = new TableLayoutConstraints + (0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL); + + double col[] = layout.getColumn(); + double row[] = layout.getRow(); + + for (int c = 1; c < col.length; c++) + for (int r = 1; r < row.length; r++) + { + constraint.col1 = constraint.col2 = c; + constraint.row1 = constraint.row2 = r; + Box box = new Box(); + panel.add (box, constraint); + } + } + + + + /** + * Generates code based on the current layout and Smiley controls. + */ + + private void generateCode () + { + String code = + "import java.awt.*;\n" + + "import java.awt.event.*;\n" + + "import layout.TableLayout;\n\n" + + + "public class MyClass\n" + + "{\n\n" + + + " public static void main (String args[])\n" + + " {\n" + + " Frame frame = new Frame(\"MyTitle\");\n" + + " frame.setBounds (100, 100, 300, 300);\n\n" + + + " double size[][] =\n" + + " {{"; + + double size[] = layout.getColumn(); + + if (size.length > 0) + code += size[0]; + + for (int i = 1; i < size.length; i++) + code += ", " + size[i]; + + code += "}, // Columns\n" + + " {"; + + size = layout.getRow(); + + if (size.length > 0) + code += size[0]; + + for (int i = 1; i < size.length; i++) + code += ", " + size[i]; + + code += "}}; // Rows\n\n" + + " frame.setLayout (new TableLayout(size));\n\n" + + " Button button;\n"; + + Component component[] = panel.getComponents(); + + for (int i = 0; i < component.length; i++) + { + if (component[i] instanceof Smiley) + { + TableLayoutConstraints c = layout.getConstraints(component[i]); + String constraint = "" + c.col1 + ", " + c.row1 + ", "; + + if ((c.col1 == c.col2) && (c.row1 == c.row2)) + { + String h[] = {"L", "C", "F", "R"}; + String v[] = {"T", "C", "F", "B"}; + constraint += h[c.hAlign] + ", " + v[c.vAlign]; + } + else + constraint += c.col2 + ", " + c.row2; + + code += + " button = new Button(\"" + constraint + "\");\n" + + " frame.add (button, \"" + constraint + "\");\n"; + } + } + + code += + "\n" + + " frame.addWindowListener\n" + + " (new WindowAdapter()\n" + + " {\n" + + " public void windowClosing (WindowEvent e)\n" + + " {\n" + + " System.exit (0);\n" + + " }\n" + + " }\n" + + " );\n\n" + + " frame.show();\n" + + " }\n" + + "}\n"; + + textArea.setText (code); + } + + + + /** + * This inner class is a component that looks like a box. + */ + + public class Box extends Component implements MouseListener + { + public Box () + { + super(); + addMouseListener(this); + } + + public void update (Graphics g) + { + paint (g); + } + + public void paint (Graphics g) + { + Dimension d = getSize(); + g.setColor (Color.black); + g.drawRect (0, 0, d.width - 1, d.height - 1); + } + + public void mouseExited(java.awt.event.MouseEvent mouseEvent) {} + public void mousePressed(java.awt.event.MouseEvent mouseEvent) {} + public void mouseClicked(java.awt.event.MouseEvent mouseEvent) {} + public void mouseEntered(java.awt.event.MouseEvent mouseEvent) {} + + public void mouseReleased(java.awt.event.MouseEvent mouseEvent) + { + TableLayoutConstraints c = layout.getConstraints(this); + Smiley smiley = new Smiley(); + Container container = getParent(); + container.add(smiley, c, 0); + container.doLayout(); + } + } + + + + /** + * This inner class is a component that looks like a smiley face. + */ + + public class Smiley extends Component implements MouseListener + { + public Smiley () + { + super(); + addMouseListener (this); + } + + public Dimension getPreferredSize () + { + return new Dimension(64, 64); + } + + public void update (Graphics g) + { + paint (g); + } + + public void paint (Graphics g) + { + Dimension d = getSize(); + int width_1_8 = d.width >> 3; + int width_7_8 = d.width - width_1_8; + int width_1_4 = d.width >> 2; + int width_3_4 = d.width - width_1_4; + int width_5_8 = width_3_4 - width_1_8; + int width_1_2 = d.width >> 1; + int height_1_8 = d.height >> 3; + int height_7_8 = d.height - height_1_8; + int height_1_4 = d.height >> 2; + int height_3_4 = d.height - height_1_4; + int height_5_8 = height_7_8 - height_1_4; + + g.setColor (Color.yellow); + g.fillArc (0, 0, d.width - 1, d.height - 1, 0, 360); + g.setColor (Color.blue); + g.fillArc (width_1_4, height_1_4, width_1_8, height_1_8, 0, 360); + g.fillArc (width_5_8, height_1_4, width_1_8, height_1_8, 0, 360); + g.setColor (Color.red); + g.fillArc (width_1_4, height_5_8, width_1_2, height_1_4, 180, 180); + } + + public void mouseExited(java.awt.event.MouseEvent mouseEvent) {} + public void mousePressed(java.awt.event.MouseEvent mouseEvent) {} + public void mouseClicked(java.awt.event.MouseEvent mouseEvent) {} + public void mouseEntered(java.awt.event.MouseEvent mouseEvent) {} + + public void mouseReleased(java.awt.event.MouseEvent mouseEvent) + { + // Get constraints applied to this Smiley + TableLayoutConstraints c = layout.getConstraints(this); + + // Create controls + Panel panel = new Panel(); + + int numRow = layout.getNumRow(); + int numColumn = layout.getNumColumn(); + + Choice choiceCol1 = new Choice(); + Choice choiceCol2 = new Choice(); + Choice choiceRow1 = new Choice(); + Choice choiceRow2 = new Choice(); + + for (int i = 1; i < numColumn; i++) + { + choiceCol1.add ("" + i); + choiceCol2.add ("" + i); + } + + for (int i = 1; i < numRow; i++) + { + choiceRow1.add ("" + i); + choiceRow2.add ("" + i); + } + + choiceCol1.select (c.col1 - 1); + choiceCol2.select (c.col2 - 1); + choiceRow1.select (c.row1 - 1); + choiceRow2.select (c.row2 - 1); + + Choice choiceAlignH = new Choice(); + choiceAlignH.add ("Left"); + choiceAlignH.add ("Center"); + choiceAlignH.add ("Full"); + choiceAlignH.add ("Right"); + choiceAlignH.select (c.hAlign); + + Choice choiceAlignV = new Choice(); + choiceAlignV.add ("Top"); + choiceAlignV.add ("Center"); + choiceAlignV.add ("Full"); + choiceAlignV.add ("Bottom"); + choiceAlignV.select (c.vAlign); + + JLabel labelCol1 = new JLabel("Column 1"); + JLabel labelCol2 = new JLabel("Column 2"); + JLabel labelRow1 = new JLabel("Row 1"); + JLabel labelRow2 = new JLabel("Row 2"); + JLabel labelAlignH = new JLabel("Horizontal Justification"); + JLabel labelAlignV = new JLabel("Vertical Justification"); + labelAlignH.setHorizontalAlignment (JLabel.RIGHT); + labelAlignV.setHorizontalAlignment (JLabel.RIGHT); + + // Create layout + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double s = 10; + + double size[][] = + {{f, p, s, p, s, p, s, p, f}, + {p, s, p, s, p, s, p, s, p, s, p}}; + + TableLayout panelLayout = new TableLayout(size); + panel.setLayout (panelLayout); + + // Add controls + panel.add (labelCol1, "1, 0, R, B"); + panel.add (choiceCol1, "3, 0, L, B"); + panel.add (labelRow1, "5, 0, R, B"); + panel.add (choiceRow1, "7, 0, L, B"); + panel.add (labelCol2, "1, 2, R, B"); + panel.add (choiceCol2, "3, 2, L, B"); + panel.add (labelRow2, "5, 2, R, B"); + panel.add (choiceRow2, "7, 2, L, B"); + panel.add (labelAlignH, "0, 4, 3, 4"); + panel.add (choiceAlignH, "5, 4, 7, 4"); + panel.add (labelAlignV, "0, 6, 3, 6"); + panel.add (choiceAlignV, "5, 6, 7, 6"); + + // Prompt user + String button[] = {"Update Smiley", "Remove Smiley", "Cancel"}; + + GeneralDialog dialog = new GeneralDialog + (RadTool.this, "Update Smiley", "", button, null, panel); + + String answer = dialog.promptUser(); + + // Update constraints applied to this Smiley + if (answer.equals("Update Smiley")) + { + // Get columns + int col1 = choiceCol1.getSelectedIndex() + 1; + int col2 = choiceCol2.getSelectedIndex() + 1; + int row1 = choiceRow1.getSelectedIndex() + 1; + int row2 = choiceRow2.getSelectedIndex() + 1; + + // Make sure col1 < col2 + if (col1 > col2) + { + int temp = col1; + col1 = col2; + col2 = temp; + } + + // Make sure row1 < row2 + if (row1 > row2) + { + int temp = row1; + row1 = row2; + row2 = temp; + } + + // Apply new constraints + c.col1 = col1; + c.col2 = col2; + c.row1 = row1; + c.row2 = row2; + c.hAlign = choiceAlignH.getSelectedIndex(); + c.vAlign = choiceAlignV.getSelectedIndex(); + layout.setConstraints (this, c); + + // Repaint and layout container since layout has changed + Container container = getParent(); + container.doLayout(); + container.repaint(); + } + // Remove Smiley + else if (answer.equals("Remove Smiley")) + { + Container container = getParent(); + container.remove (this); + container.doLayout(); + container.repaint(); + } + } + } + + + +} diff --git a/lib/example/Simple$1.class b/lib/example/Simple$1.class new file mode 100644 index 0000000..d8ad138 Binary files /dev/null and b/lib/example/Simple$1.class differ diff --git a/lib/example/Simple.class b/lib/example/Simple.class new file mode 100644 index 0000000..8fc8404 Binary files /dev/null and b/lib/example/Simple.class differ diff --git a/lib/example/Simple.java b/lib/example/Simple.java new file mode 100644 index 0000000..3ff9fb9 --- /dev/null +++ b/lib/example/Simple.java @@ -0,0 +1,62 @@ +package example; + + + +import java.awt.*; +import java.awt.event.*; +import layout.TableLayout; + + + +public class Simple +{ + + + + public static void main (String args[]) + { + // Create a frame + Frame frame = new Frame("Example of TableLayout"); + frame.setBounds (100, 100, 300, 300); + + // Create a TableLayout for the frame + double border = 10; + double size[][] = + {{border, 0.10, 20, TableLayout.FILL, 20, 0.20, border}, // Columns + {border, 0.20, 20, TableLayout.FILL, 20, 0.20, border}}; // Rows + + frame.setLayout (new TableLayout(size)); + + // Create some buttons + String label[] = {"Top", "Bottom", "Left", "Right", "Center", "Overlap"}; + Button button[] = new Button[label.length]; + + for (int i = 0; i < label.length; i++) + button[i] = new Button(label[i]); + + // Add buttons + frame.add (button[0], "1, 1, 5, 1"); // Top + frame.add (button[1], "1, 5, 5, 5"); // Bottom + frame.add (button[2], "1, 3 "); // Left + frame.add (button[3], "5, 3 "); // Right + frame.add (button[4], "3, 3, c, c"); // Center + frame.add (button[5], "3, 3, 3, 5"); // Overlap + + // Allow user to close the window to terminate the program + frame.addWindowListener + (new WindowAdapter() + { + public void windowClosing (WindowEvent e) + { + System.exit (0); + } + } + ); + + // Show frame + frame.show(); + } + + + +} \ No newline at end of file diff --git a/lib/example/TypicalGui$1.class b/lib/example/TypicalGui$1.class new file mode 100644 index 0000000..571f3ee Binary files /dev/null and b/lib/example/TypicalGui$1.class differ diff --git a/lib/example/TypicalGui$ColorBox.class b/lib/example/TypicalGui$ColorBox.class new file mode 100644 index 0000000..9c6555d Binary files /dev/null and b/lib/example/TypicalGui$ColorBox.class differ diff --git a/lib/example/TypicalGui.class b/lib/example/TypicalGui.class new file mode 100644 index 0000000..cc6dfb5 Binary files /dev/null and b/lib/example/TypicalGui.class differ diff --git a/lib/example/TypicalGui.java b/lib/example/TypicalGui.java new file mode 100644 index 0000000..ab80ff1 --- /dev/null +++ b/lib/example/TypicalGui.java @@ -0,0 +1,179 @@ +package example; + + + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import layout.TableLayout; + + + +public class TypicalGui extends JFrame +{ + + + + public static void main (String args[]) + { + new TypicalGui(); + } + + + + public TypicalGui () + { + super ("A Typical GUI"); + + Container pane = getContentPane(); + + double b = 10; + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double size[][] = {{b, f, 5, p, 5, p, b}, {p, b, f, 10, p, b}}; + TableLayout layout = new TableLayout(size); + pane.setLayout (layout); + + addMenu(pane); + addCommandButtons(pane, layout); + addColorBoxes(pane, layout); + addTextArea(pane, layout); + + allowClosing(); + setSize (640, 480); + show(); + } + + + + public void addMenu (Container pane) + { + JMenuBar menuBar = new JMenuBar(); + + String menuText[] = {"File", "Edit", "View", "Help"}; + String itemText[][] = + {{"New", "Open", "Save", "Print", "Exit"}, + {"Cut", "Copy", "Paste"}, + {"Zoom in", "Zoom out"}, + {"About", "Index", "Search"}}; + + for (int i = 0; i < menuText.length; i++) + { + JMenu menu = new JMenu(menuText[i]); + menuBar.add (menu); + + for (int j = 0; j < itemText[i].length; j++) + { + JMenuItem item = new JMenuItem(itemText[i][j]); + menu.add (item); + } + } + + pane.add (menuBar, "0, 0, 6, 0"); + } + + + + public void addCommandButtons (Container pane, TableLayout layout) + { + JPanel buttonPanel = new JPanel(); + pane.add (buttonPanel, "1, 4, 5, 4"); + + for (int i = 1; i <= 5; i++) + { + JButton button = new JButton("Button " + i); + buttonPanel.add (button); + } + } + + + + public void addColorBoxes (Container pane, TableLayout layout) + { + Color color[][] = + {{Color.white, Color.black}, + {Color.green, Color.blue}, + {Color.red, Color.yellow}, + {Color.pink, Color.orange}, + {Color.magenta, Color.cyan}}; + + for (int i = 0; i < color.length; i++) + { + // Add a row for spacing and a row for the color boxes + layout.insertRow (2, TableLayout.PREFERRED); + layout.insertRow (2, 5); + + // Add color boxes + pane.add (new ColorBox(color[i][0]), "3, 3"); + pane.add (new ColorBox(color[i][1]), "5, 3"); + } + + // Remove the unnecessary leading space + layout.deleteRow (2); + } + + + + public void addTextArea (Container pane, TableLayout layout) + { + int numRow = layout.getRow().length; + JTextPane textArea = new JTextPane(); + pane.add (textArea, "1, 2, 1, " + (numRow - 4)); + } + + + + public void allowClosing () + { + addWindowListener + (new WindowAdapter() + { + public void windowClosing (WindowEvent e) + { + System.exit (0); + } + } + ); + } + + + + //************************************************************************** + //*** Inner classes *** + //************************************************************************** + + + + protected class ColorBox extends Component + { + protected Color color; + + protected ColorBox (Color color) + { + this.color = color; + } + + public void update (Graphics g) + { + paint (g); + } + + public void paint (Graphics g) + { + Dimension d = getSize(); + g.setColor (Color.black); + g.drawRect (0, 0, d.width - 1, d.height - 1); + + g.setColor (color); + g.fillRect (1, 1, d.width - 1, d.height - 1); + } + + public Dimension getPreferredSize () + { + return new Dimension(40, 20);; + } + } + + + +} diff --git a/lib/hamcrest-core-1.3.jar b/lib/hamcrest-core-1.3.jar new file mode 100644 index 0000000..9d5fe16 Binary files /dev/null and b/lib/hamcrest-core-1.3.jar differ diff --git a/lib/jcommon-1.0.16.jar b/lib/jcommon-1.0.16.jar new file mode 100644 index 0000000..4cd6807 Binary files /dev/null and b/lib/jcommon-1.0.16.jar differ diff --git a/lib/jfreechart-1.0.13.jar b/lib/jfreechart-1.0.13.jar new file mode 100644 index 0000000..83c6993 Binary files /dev/null and b/lib/jfreechart-1.0.13.jar differ diff --git a/lib/junit-4.13.jar b/lib/junit-4.13.jar new file mode 100644 index 0000000..acc3c43 Binary files /dev/null and b/lib/junit-4.13.jar differ diff --git a/lib/looks-2.1.4.jar b/lib/looks-2.1.4.jar new file mode 100644 index 0000000..d2c47c7 Binary files /dev/null and b/lib/looks-2.1.4.jar differ diff --git a/src/control/images/Manual_confirmation_no.png b/src/control/images/Manual_confirmation_no.png new file mode 100644 index 0000000..08ffcf0 Binary files /dev/null and b/src/control/images/Manual_confirmation_no.png differ diff --git a/src/control/images/Manual_confirmation_unknown.png b/src/control/images/Manual_confirmation_unknown.png new file mode 100644 index 0000000..d53ad68 Binary files /dev/null and b/src/control/images/Manual_confirmation_unknown.png differ diff --git a/src/control/images/Manual_confirmation_yes.png b/src/control/images/Manual_confirmation_yes.png new file mode 100644 index 0000000..3915fb6 Binary files /dev/null and b/src/control/images/Manual_confirmation_yes.png differ diff --git a/src/control/images/agree_no.gif b/src/control/images/agree_no.gif new file mode 100644 index 0000000..5bf7e2c Binary files /dev/null and b/src/control/images/agree_no.gif differ diff --git a/src/control/images/agree_ok.gif b/src/control/images/agree_ok.gif new file mode 100644 index 0000000..68d734c Binary files /dev/null and b/src/control/images/agree_ok.gif differ diff --git a/src/control/images/arrow_down.png b/src/control/images/arrow_down.png new file mode 100644 index 0000000..a9eb825 Binary files /dev/null and b/src/control/images/arrow_down.png differ diff --git a/src/control/images/arrow_left.png b/src/control/images/arrow_left.png new file mode 100644 index 0000000..b8578da Binary files /dev/null and b/src/control/images/arrow_left.png differ diff --git a/src/control/images/arrow_left_down.png b/src/control/images/arrow_left_down.png new file mode 100644 index 0000000..344bab2 Binary files /dev/null and b/src/control/images/arrow_left_down.png differ diff --git a/src/control/images/arrow_left_up.png b/src/control/images/arrow_left_up.png new file mode 100644 index 0000000..075f0d9 Binary files /dev/null and b/src/control/images/arrow_left_up.png differ diff --git a/src/control/images/back1.jpg b/src/control/images/back1.jpg new file mode 100644 index 0000000..f85fa1a Binary files /dev/null and b/src/control/images/back1.jpg differ diff --git a/src/control/images/back2.jpg b/src/control/images/back2.jpg new file mode 100644 index 0000000..e4f722c Binary files /dev/null and b/src/control/images/back2.jpg differ diff --git a/src/control/images/chartpanel/exportToImage.png b/src/control/images/chartpanel/exportToImage.png new file mode 100644 index 0000000..94198be Binary files /dev/null and b/src/control/images/chartpanel/exportToImage.png differ diff --git a/src/control/images/chartpanel/pan.png b/src/control/images/chartpanel/pan.png new file mode 100644 index 0000000..a367b39 Binary files /dev/null and b/src/control/images/chartpanel/pan.png differ diff --git a/src/control/images/chartpanel/zoomIn.png b/src/control/images/chartpanel/zoomIn.png new file mode 100644 index 0000000..5ca924b Binary files /dev/null and b/src/control/images/chartpanel/zoomIn.png differ diff --git a/src/control/images/chartpanel/zoomOut.png b/src/control/images/chartpanel/zoomOut.png new file mode 100644 index 0000000..34ea7be Binary files /dev/null and b/src/control/images/chartpanel/zoomOut.png differ diff --git a/src/control/images/chartpanel/zoomReset.png b/src/control/images/chartpanel/zoomReset.png new file mode 100644 index 0000000..52e005c Binary files /dev/null and b/src/control/images/chartpanel/zoomReset.png differ diff --git a/src/control/images/chartpanel/zoomToOverview.png b/src/control/images/chartpanel/zoomToOverview.png new file mode 100644 index 0000000..0566e8e Binary files /dev/null and b/src/control/images/chartpanel/zoomToOverview.png differ diff --git a/src/control/images/email.png b/src/control/images/email.png new file mode 100644 index 0000000..94e0869 Binary files /dev/null and b/src/control/images/email.png differ diff --git a/src/control/images/exit.gif b/src/control/images/exit.gif new file mode 100644 index 0000000..9846fa6 Binary files /dev/null and b/src/control/images/exit.gif differ diff --git a/src/control/images/gc.png b/src/control/images/gc.png new file mode 100644 index 0000000..d1e300b Binary files /dev/null and b/src/control/images/gc.png differ diff --git a/src/control/images/header_background.png b/src/control/images/header_background.png new file mode 100644 index 0000000..99b4ea4 Binary files /dev/null and b/src/control/images/header_background.png differ diff --git a/src/control/images/header_background_left.png b/src/control/images/header_background_left.png new file mode 100644 index 0000000..6304e77 Binary files /dev/null and b/src/control/images/header_background_left.png differ diff --git a/src/control/images/header_background_right.png b/src/control/images/header_background_right.png new file mode 100644 index 0000000..3fe3364 Binary files /dev/null and b/src/control/images/header_background_right.png differ diff --git a/src/control/images/list_item_default_icon.png b/src/control/images/list_item_default_icon.png new file mode 100644 index 0000000..d259489 Binary files /dev/null and b/src/control/images/list_item_default_icon.png differ diff --git a/src/control/images/logo.png b/src/control/images/logo.png new file mode 100644 index 0000000..f39bbb7 Binary files /dev/null and b/src/control/images/logo.png differ diff --git a/src/control/images/logo1.png b/src/control/images/logo1.png new file mode 100644 index 0000000..b983eba Binary files /dev/null and b/src/control/images/logo1.png differ diff --git a/src/control/images/logo2.png b/src/control/images/logo2.png new file mode 100644 index 0000000..4d1a092 Binary files /dev/null and b/src/control/images/logo2.png differ diff --git a/src/control/images/menu_arrow.png b/src/control/images/menu_arrow.png new file mode 100644 index 0000000..399f188 Binary files /dev/null and b/src/control/images/menu_arrow.png differ diff --git a/src/control/images/menubar_background.png b/src/control/images/menubar_background.png new file mode 100644 index 0000000..da7fa0e Binary files /dev/null and b/src/control/images/menubar_background.png differ diff --git a/src/control/images/menubar_background_left.png b/src/control/images/menubar_background_left.png new file mode 100644 index 0000000..ff0a871 Binary files /dev/null and b/src/control/images/menubar_background_left.png differ diff --git a/src/control/images/menubar_background_right.png b/src/control/images/menubar_background_right.png new file mode 100644 index 0000000..c7d8c5f Binary files /dev/null and b/src/control/images/menubar_background_right.png differ diff --git a/src/control/images/menubar_background_selected.png b/src/control/images/menubar_background_selected.png new file mode 100644 index 0000000..0250723 Binary files /dev/null and b/src/control/images/menubar_background_selected.png differ diff --git a/src/control/images/module_node.png b/src/control/images/module_node.png new file mode 100644 index 0000000..0b22eb8 Binary files /dev/null and b/src/control/images/module_node.png differ diff --git a/src/control/images/module_node_selected.png b/src/control/images/module_node_selected.png new file mode 100644 index 0000000..9caf91b Binary files /dev/null and b/src/control/images/module_node_selected.png differ diff --git a/src/control/images/onError.gif b/src/control/images/onError.gif new file mode 100644 index 0000000..e1b6bdb Binary files /dev/null and b/src/control/images/onError.gif differ diff --git a/src/control/images/outlookPanel/module_selected.png b/src/control/images/outlookPanel/module_selected.png new file mode 100644 index 0000000..fd70582 Binary files /dev/null and b/src/control/images/outlookPanel/module_selected.png differ diff --git a/src/control/images/outlookPanel/module_unselected.png b/src/control/images/outlookPanel/module_unselected.png new file mode 100644 index 0000000..1fe6f7a Binary files /dev/null and b/src/control/images/outlookPanel/module_unselected.png differ diff --git a/src/control/images/outlook_bar_background.png b/src/control/images/outlook_bar_background.png new file mode 100644 index 0000000..ab8c9f7 Binary files /dev/null and b/src/control/images/outlook_bar_background.png differ diff --git a/src/control/images/outlook_bar_background_selected.png b/src/control/images/outlook_bar_background_selected.png new file mode 100644 index 0000000..553624b Binary files /dev/null and b/src/control/images/outlook_bar_background_selected.png differ diff --git a/src/control/images/outlook_bar_background_selected_left.png b/src/control/images/outlook_bar_background_selected_left.png new file mode 100644 index 0000000..d391a24 Binary files /dev/null and b/src/control/images/outlook_bar_background_selected_left.png differ diff --git a/src/control/images/outlook_bar_background_selected_right.png b/src/control/images/outlook_bar_background_selected_right.png new file mode 100644 index 0000000..a7daf4c Binary files /dev/null and b/src/control/images/outlook_bar_background_selected_right.png differ diff --git a/src/control/images/outlook_bar_handler.png b/src/control/images/outlook_bar_handler.png new file mode 100644 index 0000000..b727e8b Binary files /dev/null and b/src/control/images/outlook_bar_handler.png differ diff --git a/src/control/images/outlook_bar_handler_selected.png b/src/control/images/outlook_bar_handler_selected.png new file mode 100644 index 0000000..b317475 Binary files /dev/null and b/src/control/images/outlook_bar_handler_selected.png differ diff --git a/src/control/images/progress_select_background.png b/src/control/images/progress_select_background.png new file mode 100644 index 0000000..e46c3bb Binary files /dev/null and b/src/control/images/progress_select_background.png differ diff --git a/src/control/images/progress_selected_left.png b/src/control/images/progress_selected_left.png new file mode 100644 index 0000000..60e4fd9 Binary files /dev/null and b/src/control/images/progress_selected_left.png differ diff --git a/src/control/images/progress_selected_right.png b/src/control/images/progress_selected_right.png new file mode 100644 index 0000000..fc21624 Binary files /dev/null and b/src/control/images/progress_selected_right.png differ diff --git a/src/control/images/progress_unselect_background.png b/src/control/images/progress_unselect_background.png new file mode 100644 index 0000000..b1e90de Binary files /dev/null and b/src/control/images/progress_unselect_background.png differ diff --git a/src/control/images/resize_handler.png b/src/control/images/resize_handler.png new file mode 100644 index 0000000..6e892c6 Binary files /dev/null and b/src/control/images/resize_handler.png differ diff --git a/src/control/images/separator_background.png b/src/control/images/separator_background.png new file mode 100644 index 0000000..007c518 Binary files /dev/null and b/src/control/images/separator_background.png differ diff --git a/src/control/images/server.png b/src/control/images/server.png new file mode 100644 index 0000000..49d9bd0 Binary files /dev/null and b/src/control/images/server.png differ diff --git a/src/control/images/shrink_handler_left.png b/src/control/images/shrink_handler_left.png new file mode 100644 index 0000000..c52b66c Binary files /dev/null and b/src/control/images/shrink_handler_left.png differ diff --git a/src/control/images/shrink_handler_right.png b/src/control/images/shrink_handler_right.png new file mode 100644 index 0000000..99ef162 Binary files /dev/null and b/src/control/images/shrink_handler_right.png differ diff --git a/src/control/images/statusbar_background.png b/src/control/images/statusbar_background.png new file mode 100644 index 0000000..71bbac2 Binary files /dev/null and b/src/control/images/statusbar_background.png differ diff --git a/src/control/images/statusbar_background_left.png b/src/control/images/statusbar_background_left.png new file mode 100644 index 0000000..4c3bb0f Binary files /dev/null and b/src/control/images/statusbar_background_left.png differ diff --git a/src/control/images/statusbar_background_right.png b/src/control/images/statusbar_background_right.png new file mode 100644 index 0000000..7433e88 Binary files /dev/null and b/src/control/images/statusbar_background_right.png differ diff --git a/src/control/images/statusbar_message_light_green.png b/src/control/images/statusbar_message_light_green.png new file mode 100644 index 0000000..4999e77 Binary files /dev/null and b/src/control/images/statusbar_message_light_green.png differ diff --git a/src/control/images/statusbar_message_light_orange.png b/src/control/images/statusbar_message_light_orange.png new file mode 100644 index 0000000..63e7de4 Binary files /dev/null and b/src/control/images/statusbar_message_light_orange.png differ diff --git a/src/control/images/statusbar_message_light_red.png b/src/control/images/statusbar_message_light_red.png new file mode 100644 index 0000000..c22f7a2 Binary files /dev/null and b/src/control/images/statusbar_message_light_red.png differ diff --git a/src/control/images/statusbar_separator.png b/src/control/images/statusbar_separator.png new file mode 100644 index 0000000..bab1de5 Binary files /dev/null and b/src/control/images/statusbar_separator.png differ diff --git a/src/control/images/submodule.png b/src/control/images/submodule.png new file mode 100644 index 0000000..207289a Binary files /dev/null and b/src/control/images/submodule.png differ diff --git a/src/control/images/tab_close.png b/src/control/images/tab_close.png new file mode 100644 index 0000000..3c08ef8 Binary files /dev/null and b/src/control/images/tab_close.png differ diff --git a/src/control/images/tab_close_pressed.png b/src/control/images/tab_close_pressed.png new file mode 100644 index 0000000..76b2d21 Binary files /dev/null and b/src/control/images/tab_close_pressed.png differ diff --git a/src/control/images/tab_header_background.png b/src/control/images/tab_header_background.png new file mode 100644 index 0000000..3555855 Binary files /dev/null and b/src/control/images/tab_header_background.png differ diff --git a/src/control/images/tab_header_selected_background_left.png b/src/control/images/tab_header_selected_background_left.png new file mode 100644 index 0000000..7624a75 Binary files /dev/null and b/src/control/images/tab_header_selected_background_left.png differ diff --git a/src/control/images/tab_header_selected_background_right.png b/src/control/images/tab_header_selected_background_right.png new file mode 100644 index 0000000..f105cb6 Binary files /dev/null and b/src/control/images/tab_header_selected_background_right.png differ diff --git a/src/control/images/tab_header_unselected_background.png b/src/control/images/tab_header_unselected_background.png new file mode 100644 index 0000000..888db7a Binary files /dev/null and b/src/control/images/tab_header_unselected_background.png differ diff --git a/src/control/images/tab_header_unselected_background_left.png b/src/control/images/tab_header_unselected_background_left.png new file mode 100644 index 0000000..ee3eb6b Binary files /dev/null and b/src/control/images/tab_header_unselected_background_left.png differ diff --git a/src/control/images/tab_header_unselected_background_right.png b/src/control/images/tab_header_unselected_background_right.png new file mode 100644 index 0000000..10daac8 Binary files /dev/null and b/src/control/images/tab_header_unselected_background_right.png differ diff --git a/src/control/images/textfield_background.png b/src/control/images/textfield_background.png new file mode 100644 index 0000000..02c004f Binary files /dev/null and b/src/control/images/textfield_background.png differ diff --git a/src/control/images/textfield_background_left.png b/src/control/images/textfield_background_left.png new file mode 100644 index 0000000..741acbc Binary files /dev/null and b/src/control/images/textfield_background_left.png differ diff --git a/src/control/images/textfield_background_right.png b/src/control/images/textfield_background_right.png new file mode 100644 index 0000000..b312518 Binary files /dev/null and b/src/control/images/textfield_background_right.png differ diff --git a/src/control/images/toolbar/add.png b/src/control/images/toolbar/add.png new file mode 100644 index 0000000..0374b7c Binary files /dev/null and b/src/control/images/toolbar/add.png differ diff --git a/src/control/images/toolbar/capture.png b/src/control/images/toolbar/capture.png new file mode 100644 index 0000000..4121be9 Binary files /dev/null and b/src/control/images/toolbar/capture.png differ diff --git a/src/control/images/toolbar/chart.png b/src/control/images/toolbar/chart.png new file mode 100644 index 0000000..dc94e72 Binary files /dev/null and b/src/control/images/toolbar/chart.png differ diff --git a/src/control/images/toolbar/email.png b/src/control/images/toolbar/email.png new file mode 100644 index 0000000..94e0869 Binary files /dev/null and b/src/control/images/toolbar/email.png differ diff --git a/src/control/images/toolbar/home.png b/src/control/images/toolbar/home.png new file mode 100644 index 0000000..28c7279 Binary files /dev/null and b/src/control/images/toolbar/home.png differ diff --git a/src/control/images/toolbar/image_edit.png b/src/control/images/toolbar/image_edit.png new file mode 100644 index 0000000..5d8fa5b Binary files /dev/null and b/src/control/images/toolbar/image_edit.png differ diff --git a/src/control/images/toolbar/left.png b/src/control/images/toolbar/left.png new file mode 100644 index 0000000..302ed19 Binary files /dev/null and b/src/control/images/toolbar/left.png differ diff --git a/src/control/images/toolbar/message.png b/src/control/images/toolbar/message.png new file mode 100644 index 0000000..c0ef149 Binary files /dev/null and b/src/control/images/toolbar/message.png differ diff --git a/src/control/images/toolbar/print.png b/src/control/images/toolbar/print.png new file mode 100644 index 0000000..e5aca4c Binary files /dev/null and b/src/control/images/toolbar/print.png differ diff --git a/src/control/images/toolbar/refresh.png b/src/control/images/toolbar/refresh.png new file mode 100644 index 0000000..19b79ed Binary files /dev/null and b/src/control/images/toolbar/refresh.png differ diff --git a/src/control/images/toolbar/right.png b/src/control/images/toolbar/right.png new file mode 100644 index 0000000..7f15cd6 Binary files /dev/null and b/src/control/images/toolbar/right.png differ diff --git a/src/control/images/toolbar/update.png b/src/control/images/toolbar/update.png new file mode 100644 index 0000000..b02465f Binary files /dev/null and b/src/control/images/toolbar/update.png differ diff --git a/src/control/images/toolbar/user.png b/src/control/images/toolbar/user.png new file mode 100644 index 0000000..d25bce2 Binary files /dev/null and b/src/control/images/toolbar/user.png differ diff --git a/src/control/images/toolbar/viewer.png b/src/control/images/toolbar/viewer.png new file mode 100644 index 0000000..638d70c Binary files /dev/null and b/src/control/images/toolbar/viewer.png differ diff --git a/src/control/images/toolbar_background.png b/src/control/images/toolbar_background.png new file mode 100644 index 0000000..3f4329a Binary files /dev/null and b/src/control/images/toolbar_background.png differ diff --git a/src/control/images/toolbar_separator.png b/src/control/images/toolbar_separator.png new file mode 100644 index 0000000..50d92b6 Binary files /dev/null and b/src/control/images/toolbar_separator.png differ diff --git a/src/cppcheckplus/control/Main.java b/src/cppcheckplus/control/Main.java new file mode 100644 index 0000000..4c84eac --- /dev/null +++ b/src/cppcheckplus/control/Main.java @@ -0,0 +1,917 @@ +package cppcheckplus.control; + +import cppcheckplus.menu.MyMenuBar; +import cppcheckplus.outlookpanel.MyOutlookPanel; +import cppcheckplus.outlookpanel.MyOutlookPanelListItem; +import cppcheckplus.shortcut.MyShortcutPanel; +import cppcheckplus.shortcut.MyTree; +import cppcheckplus.tab.MyTabPage; +import cppcheckplus.tab.MyTabPage1; +import cppcheckplus.tab.MyTabPanel; +import cppcheckplus.tab.MyTabPanel1; +import cppcheckplus.text.FileTools; +import cppcheckplus.text.MyPanel; +import cppcheckplus.text.MyTextPanel; +import cppcheckplus.text.MyTextPanel1; +import cppcheckplus.text.ViewPanel; +import cppcheckplus.text.creatTable; +import java.awt.BorderLayout; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.plaf.TabbedPaneUI; +import javax.xml.parsers.ParserConfigurationException; + + +// 构造界面和各个工具的调用逻辑 +public class Main extends JFrame { + //private String target = "";// dump文件路径 + public static final int SUCCESS = 0; // 表示程序执行成功 + public static final String COMMAND = "java.exe -version"; // 要执行的语句 + public static final String SUCCESS_MESSAGE = "程序执行成功!"; + public static final String ERROR_MESSAGE = "程序执行出错:"; + public static final String ENTERWindows = "\r\n"; + public static final String ENTERLinux = "\n"; + // XML配置文件路径 + private final String menuBarXML; + private final String outlookPanelXML; + private final String settingsXML; + private final String stdclangXML; + // 界面组件 + private final MyContentPanel contentPanel; + private final MyMenuBar menubar; + private final JFileChooser jfc = new JFileChooser();// 文件选择器 + private final JFileChooser jfsettings = new JFileChooser();// 配置设定 + public MyTabPanel tabPanel; + // 编辑代码的面板 + public MyTextPanel testCode; + public String src = ""; // 目标源文件或目录的路径 + public String cppcheckPath = null; + public String flawfinderPath = null; + public String paracppcheck = null; + public String paraflawfinder = null; + public creatTable ct = new creatTable(); + private MyOutlookPanel outlookPanel; + private MyTabPanel1 tabPanel2; + private MyShortcutPanel shortcutPanel; + private MyTree tree; + // 标记是否修改了工具路径 + private boolean changedpathcpp = false; + private boolean changedpathflaw = false; + private MyTextPanel1 testPanel; + private ViewPanel viewPanel; + // 显示代码和检查进程的文本区域 + private JTextArea textCode;// 显示代码内容 + private TextArea textCheck;// 显示检查进度输出 + // 各工具的面板 + private MyTextPanel1 flawfinderPanel; + private MyTextPanel1 cppcheckPanel; + private MyTextPanel1 clangPanel; + // 各工具的检测结果 + private TextArea flawfinderResult;//flawfinder检测结果 + private TextArea cppcheckResult;//cppcheck检测结果 + private TextArea clangResult;//clang检测结果 + // 文件操作相关 + private File result; // 存储打开的文件 + private File report; // 导出报告时选择的文件 + private File direct; // 存储打开的目录 + private String tmpFileName = "";//tmp文件名 + //private static String inputResult = "inputResult.txt"; + //private static String errorResult = "errorResult.txt"; + private Main ui; + private final String projectPath; + + // 构造函数:初始化各个组件,加载配置文件,建立界面布局 + public Main() { + projectPath = System.getProperty("user.dir"); + // 文件选择器初始目录 + jfc.setCurrentDirectory(new File("d://")); + jfsettings.setCurrentDirectory(new File("d://")); + + // 配置文件路径 + menuBarXML = "cppcheckplus/control/menubar.xml"; + outlookPanelXML = "cppcheckplus/control/outlook.xml"; + settingsXML = "cppcheckplus/control/settings.xml"; + stdclangXML = "cppcheckplus/control/stdclang.xml"; + + MyContorlUtil.loadToolsRoad(settingsXML, this);// 加载工具路径设置到当前对象中 + ct.initSTDClang(stdclangXML);// 设置clang配置 + + // 加载菜单栏,注册事件监听 + menubar = MyContorlUtil.loadMenuBar(menuBarXML, new ActionListener() { + public void actionPerformed(ActionEvent e) { + String command = e.getActionCommand(); + switch (command) { + case "OnMenuOpen": + // 打开文件 + jfc.setFileSelectionMode(0);// 设定只能选择到文件 + int state = jfc.showOpenDialog(null); + if (state == 1) { + return; // 撤销选择则返回 + } else { + result = jfc.getSelectedFile();// result为选择到的文件 + src = result.getAbsolutePath(); + // 读取文件内容并显示到代码区 + textCode.setText(FileTools.readFile(result)); + // 如果代码标签页不存在,则创建一个 + if (!tabPanel.isSelectTabComponents("代码")) { + tabPanel.addTab("代码", testCode); + tabPanel.isSelectTabComponents("代码"); + } + } + break; + case "onMenuLoad": + // 加载目录:选择目录并更新目录树 + jfc.setFileSelectionMode(1);// 只能选择到文件夹 +// int state = jfc.showOpenDialog(null); + if (jfc.showOpenDialog(null) == 1) { + return; + } + direct = jfc.getSelectedFile();// 选择到的目录 + src = direct.getAbsolutePath(); + tree.setRootDir(direct);// 更新目录树 + break; + case "onMenuSave": + // 保存文件 + if (result != null) { + FileTools.writeFile(result, textCode.getText()); + } + break; + case "onMenuClose": + // 关闭程序 + System.exit(0); + break; + case "onMenuClean": + // 清空:清空代码、检查结果、进度信息,重置参数 + textCode.setText(""); + flawfinderResult.setText(""); + cppcheckResult.setText(""); + clangResult.setText(""); + viewPanel.clearTable(); + ct.clearall(); + textCheck.setText(""); + paracppcheck = "--enable=all"; + break; + case "onMenuExport": + // 导出:将检查结果导出到xml文件 + JFileChooser dialog = new JFileChooser(); + dialog.setDialogTitle("另存为"); + dialog.setFileSelectionMode(JFileChooser.FILES_ONLY); + dialog.setDialogType(JFileChooser.SAVE_DIALOG); + int r = dialog.showSaveDialog(ui); + if (r == JFileChooser.APPROVE_OPTION) { + report = dialog.getSelectedFile(); + FileTools.writeFile(report, ct.results); + } else { + JOptionPane.showMessageDialog(null, "路径错误", + "提示", 2); + } + break; + case "onCppcheck": + // cppcheck检查 + if (src != null && src.length() != 0) { + if (paracppcheck != null && + paracppcheck.length() != 0) { + new Thread() { + public void run() { + execute(src, paracppcheck); + } + }.start(); + } else { + JOptionPane.showMessageDialog(null, "参数错误", + "提示", 2); + } + } else { + JOptionPane.showMessageDialog(null, "目标路径错误", + "提示", 2); + } + break; + case "onClang": + // clang/clang-tidy检查 + if (src != null && src.length() != 0) { + new Thread() { + public void run() { + execute2(src); + } + }.start(); + } else { + JOptionPane.showMessageDialog(null, "目标路径错误", + "提示", 2); + } + break; + case "onFlawfinder": + // flawfinder检查 + if (src != null && src.length() != 0) { + new Thread() { + public void run() { + tmpFileName = "tmp" + "src" + ".csv"; + execute3(src, paraflawfinder, tmpFileName); + } + }.start(); + } else { + JOptionPane.showMessageDialog(null, "目标路径错误", + "提示", 2); + } + break; + case "onMenuAbout": + // 关于:显示软件信息 + JOptionPane.showMessageDialog(null, "cppcheckplus", + "提示", 2); + break; + case "onOrderType": + // 按类型排序:生成表格并按类型排序 + ct.makeTable(); + ct.ord(2); + if (!tabPanel.isSelectTabComponents("结果")) { + viewPanel = new ViewPanel(ct.results); + tabPanel.addTab("结果", createPage(viewPanel)); + tabPanel.isSelectTabComponents("结果"); + } else { + viewPanel.update(ct.results); + } + break; + case "onOrderLevel": + // 按级别排序 + ct.makeTable(); + ct.ord(3); + if (!tabPanel.isSelectTabComponents("结果")) { + viewPanel = new ViewPanel(ct.results); + tabPanel.addTab("结果", createPage(viewPanel)); + tabPanel.isSelectTabComponents("结果"); + } else { + viewPanel.update(ct.results); + } + break; + case "onOrderFile": + // 按文件排序 + ct.makeTable(); + ct.ord(1); + if (!tabPanel.isSelectTabComponents("结果")) { + viewPanel = new ViewPanel(ct.results); + tabPanel.addTab("结果", createPage(viewPanel)); + tabPanel.isSelectTabComponents("结果"); + } else { + viewPanel.update(ct.results); + } + break; + case "onSetCppcheckRoad": + // cppcheck路径 + jfsettings.setFileSelectionMode(0);// 设定只能选择到文件 +// int state = jfsettings.showOpenDialog(null); + if (jfsettings.showOpenDialog(null) == 1) { + return; // 撤销则返回 + } else { + File cppcheckFile = jfsettings.getSelectedFile(); + String cppcheckPathTemp = + cppcheckFile.getAbsolutePath(); + MyContorlUtil.fixSettingPath(settingsXML, + "cppcheck", cppcheckPathTemp); + changedpathcpp = true; + } + break; + case "onSetFlawfinderRoad": + // flawfinder路径 + jfsettings.setFileSelectionMode(0);// 设定只能选择到文件 +// int state = jfsettings.showOpenDialog(null); + if (jfsettings.showOpenDialog(null) == 1) { + return;// 撤销则返回 + } else { + File flawfinderFile = jfsettings.getSelectedFile(); + String flawfinderPathTemp = + flawfinderFile.getAbsolutePath(); + MyContorlUtil.fixSettingPath(settingsXML, + "flawfinder", flawfinderPathTemp); + changedpathflaw = true; + } + break; + } + } + }); + + // 初始化主内容面板 + contentPanel = new MyContentPanel(); + try { + initSwing(); + } catch (UnsupportedEncodingException e1) { + e1.printStackTrace(); + } + } + + public static void main(String[] args) throws ParserConfigurationException { + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + MyContorlUtil.setupLookAndFeel(); + Main ui = new Main(); + ui.setVisible(true); + } + }); + } + + private void execute(String src, String para) { + if (changedpathcpp) { + MyContorlUtil.loadToolsRoad(settingsXML, this); + changedpathcpp = false; + } + + // 路径未配置,直接返回 + if (cppcheckPath == null) { + return; + } + + Runtime runtime = Runtime.getRuntime(); + Process p = null; + Runtime runtime1 = Runtime.getRuntime(); + Process p1 = null; + try { + // 指定模板执行cppcheck,格式化输出信息 + p = runtime.exec(String.format(cppcheckPath + + " --template=\"cppcheck${file}${line}${severity}${id}${message}${cwe}\" %s %s", + para, src)); + final InputStream is1 = p.getInputStream(); + final InputStream is2 = p.getErrorStream(); + + // 不使用模板,捕获错误信息 + p1 = + runtime.exec(String.format(cppcheckPath + " %s %s", para, src)); + System.out.printf(cppcheckPath + " %s %s%n", para, src); + final InputStream is11 = p1.getInputStream(); + final InputStream is21 = p1.getErrorStream(); + + // 处理标准输出 + new Thread() { + @SuppressWarnings("resource") + public void run() { + + BufferedReader br1 = + new BufferedReader(new InputStreamReader(is1)); + //StringBuilder l1 = new StringBuilder(); + try { + + String line1 = null; + int i = 0; + textCheck.setText(""); + while ((line1 = br1.readLine()) != null) { + i++; + textCheck.append(i + " " + line1 + ENTERWindows); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("inputError"); + } finally { + try { + //textCheck.setText(new String(l1.toString().getBytes(), "utf-8")); + is1.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }.start(); + + // 处理错误流 + new Thread() { + public void run() { + BufferedReader br2 = + new BufferedReader(new InputStreamReader(is2)); + StringBuilder l2 = new StringBuilder(); + try { + String line2 = null; + while ((line2 = br2.readLine()) != null) { + ct.toRowsOfCppcheckResult(line2); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + is2.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }.start(); + + // 第二次的错误流 + new Thread() { + public void run() { + BufferedReader br2 = + new BufferedReader(new InputStreamReader(is21)); + StringBuilder l2 = new StringBuilder(); + cppcheckResult.setText(""); + try { + String line2 = null; + int i = 0; + while ((line2 = br2.readLine()) != null) { + l2.append(i + " " + line2 + ENTERWindows); + i++; + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + cppcheckResult.setText( + new String(l2.toString().getBytes(), + StandardCharsets.UTF_8)); + is21.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }.start(); + + // 等待两个进程结束 + int exitCode = p.waitFor(); + int exitCode1 = p1.waitFor(); + if (exitCode == SUCCESS) { + System.out.println(SUCCESS_MESSAGE); + + } else { + System.err.println(ERROR_MESSAGE + exitCode); + } + p.destroy(); + p1.destroy(); + } catch (Exception e) { + try { + // 出现异常则关闭相关流 + p.getErrorStream().close(); + p.getInputStream().close(); + p.getOutputStream().close(); + p1.getErrorStream().close(); + p1.getInputStream().close(); + p1.getOutputStream().close(); + } catch (Exception ee) { + } + } + if (!tabPanel.isSelectTabComponents("结果")) { + try { + ct.makeTable(); + viewPanel = new ViewPanel(ct.results); + } catch (Exception e1) { + e1.printStackTrace(); + System.out.println("图表生成错误"); + } + tabPanel.addTab("结果", createPage(viewPanel)); + tabPanel.isSelectTabComponents("结果"); + } else { + try { + ct.makeTable(); + viewPanel.update(ct.results); + } catch (Exception e1) { + e1.printStackTrace(); + System.out.println("图表生成错误"); + } + } + } + + private void execute2(String src) { + // clamh-tidy 检查 + Runtime runtime = Runtime.getRuntime(); + Process p = null; + try { + // 修改为执行 clang-tidy + String path = "C:\\MinGW\\include"; // FIXME: 需要修改为自己的路径 + Path srcPath = Paths.get(src); + String execable; + if (Files.isDirectory(srcPath)) { + // 是目录,则检查这个目录下所有cpp文件 + execable = String.format( + "clang-tidy %s\\*.cpp --checks=* --header-filter=%s -- -std=c++17 -I %s", + src, src, path); + } else { + // 是文件,直接执行 + execable = String.format( + "clang-tidy %s --checks=* --header-filter=%s -- -std=c++17 -I %s", + src, src, path); + } + //String execable1 = String.format("clang-tidy %s --checks=* --header-filter=%s -- -std=c++17 -I %s", src, src, path); + //String execable2 = String.format("clang-tidy %s\\*.cpp --checks=* --header-filter=%s -- -std=c++17 -I %s", src,src, path); + //String execable = String.format("clang-tidy %s\\*.cpp --checks='*,misc-no-delete-this,-llvmlibc-restrict-system-libc-headers,-modernize-use-trailing-return-type' -- -std=c++17 -I %s", src, path); + System.out.println(execable); + + // 执行 + p = runtime.exec(execable); // -- 表示之后是源文件 + final InputStream is1 = p.getInputStream(); // 标准输出流 + final InputStream is2 = p.getErrorStream(); // clang-tidy 的错误流 + + // 处理标准输出 + new Thread() { + public void run() { + BufferedReader br1 = + new BufferedReader(new InputStreamReader(is1)); + StringBuilder l1 = new StringBuilder(); + try { + String line1 = null; + while ((line1 = br1.readLine()) != null) { + // 只处理包含源文件路径的行 + if (line1.contains(src)) { + l1.append(line1).append(ENTERWindows); + // 如果有需要,可以将标准输出进行处理 + ct.toRowsOfClang(line1); + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + is1.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }.start(); + + // FIXME: 这一部分是否必要? + //new Thread() { + // + // + // public void run() { + // BufferedReader br2 = new BufferedReader(new InputStreamReader(is2)); + // StringBuilder l2 = new StringBuilder(); + // try { + // String line2 = null; + // int i = 0; + // clangResult.setText(""); + // while ((line2 = br2.readLine()) != null) { + // l2.append(i + " " + line2 + ENTERWindows); + // ct.toRowsOfClang(line2); // 可能需要根据 clang-tidy 的输出格式进行调整 + // i++; + // } + // } catch (Exception e) { + // e.printStackTrace(); + // System.out.println("inputError"); + // } finally { + // try { + // clangResult.setText(l2.substring(0, l2.length())); + // is2.close(); + // } catch (IOException e) { + // e.printStackTrace(); + // } + // } + // } + //}.start(); + + int exitCode = p.waitFor(); + if (exitCode == SUCCESS) { + System.out.println(SUCCESS_MESSAGE); + + } else { + System.err.println(ERROR_MESSAGE + exitCode); + } + + // 为什么需要关闭两次? + p.destroy(); + p.destroy(); + } catch (Exception e) { + try { + p.getInputStream().close(); + p.getOutputStream().close(); + p.getErrorStream().close(); + } catch (Exception ee) { + } + } + + // 更新或者创建结果标签页,显示结果 + if (!tabPanel.isSelectTabComponents("结果")) { + try { + ct.makeTable(); + viewPanel = new ViewPanel(ct.results); + } catch (Exception e1) { + e1.printStackTrace(); + System.out.println("图表生成错误"); + } + tabPanel.addTab("结果", createPage(viewPanel)); + tabPanel.isSelectTabComponents("结果"); + } else { + try { + ct.makeTable(); + viewPanel.update(ct.results); + } catch (Exception e1) { + e1.printStackTrace(); + System.out.println("图表生成错误"); + } + } + } + + private void execute3(String src, String para, String tmpFileName) { + // flawfinder + if (changedpathflaw) { + MyContorlUtil.loadToolsRoad(settingsXML, this); + changedpathflaw = false; + } + + if (flawfinderPath == null) { + return; + } + Runtime runtime = Runtime.getRuntime(); + Process p = null; + Runtime runtime2 = Runtime.getRuntime(); + Process p2 = null; + try { + + // 两个参数数组,一个是csv格式,一个是传入的参数 + String[] arguments = + new String[] {"python", flawfinderPath, "--csv", src}; + String[] arguments2 = + new String[] {"python", flawfinderPath, para, src}; + + p = runtime.exec(arguments); + p2 = runtime.exec(arguments2); + final InputStream is1 = p.getInputStream(); + final InputStream is2 = p2.getInputStream(); + System.out.println(arguments2[1]); + + // csv结果添加到表格 + new Thread() { + public void run() { + BufferedReader br1 = + new BufferedReader(new InputStreamReader(is1)); + try { + String line1 = null; + while ((line1 = br1.readLine()) != null) { + ct.toRowsOfflawfinder(line1); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + is1.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }.start(); + + // 普通结果显示在文本框 + new Thread() { + public void run() { + //flawfinder result + BufferedReader br1 = + new BufferedReader(new InputStreamReader(is2)); + StringBuilder l1 = new StringBuilder(); + flawfinderResult.setText(""); + try { + String line1 = null; + while ((line1 = br1.readLine()) != null) { + l1.append(line1 + ENTERWindows); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + flawfinderResult.setText( + l1.substring(0, l1.length())); + is2.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }.start(); + + int exitCode = p.waitFor(); + int exitCode2 = p2.waitFor(); + if (exitCode == SUCCESS) { + System.out.println(SUCCESS_MESSAGE); + } else { + System.err.println(ERROR_MESSAGE + exitCode); + } + p.destroy(); + p2.destroy(); + } catch (Exception e) { + try { + p.getErrorStream().close(); + p.getInputStream().close(); + p.getOutputStream().close(); + p2.getErrorStream().close(); + p2.getInputStream().close(); + p2.getOutputStream().close(); + } catch (Exception ee) { + } + } + if (!tabPanel.isSelectTabComponents("结果")) { + try { + ct.makeTable(); + viewPanel = new ViewPanel(ct.results); + } catch (Exception e1) { + e1.printStackTrace(); + System.out.println("图表生成错误"); + } + tabPanel.addTab("结果", createPage(viewPanel)); + tabPanel.isSelectTabComponents("结果"); + } else { + try { + ct.makeTable(); + viewPanel.update(ct.results); + } catch (Exception e1) { + e1.printStackTrace(); + System.out.println("图表生成错误"); + } + } + + } + + private void initSwing() throws UnsupportedEncodingException { + setTitle("Cppcheckplus"); + setDefaultCloseOperation(3); // 关闭窗口时退出程序 + setSize(1024, 768); + + // 设置窗口图标 + setIconImage(MyContorlUtil.getImage("control/images/logo2.png")); + setContentPane(contentPanel); + // 菜单栏在最上方 + contentPanel.add(menubar, "North"); + + // 除却菜单栏之外的面板 + //JPanel centerPane = new JPanel(new BorderLayout()); + + // 中间区域,除了菜单栏之外的所有内容 + MyPanel centerPane = new MyPanel(new BorderLayout()); + centerPane.setOpaque(true); + //centerPane.setBackground(MyContorlUtil.CONTENT_PANE_BACKGROUND3); + //centerPane.setBackground(MyContorlUtil.getImage("control/images/logo2.png")); + centerPane.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); + contentPanel.add(centerPane, "Center"); + + // 初始化各个标签页、侧边栏、目录树 + initTab(); + initTab2(); + initOutlookPanel(); + try { + initShortcutPanel(); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + initTree(); + + // 面板加入布局 + centerPane.add(outlookPanel, "West"); + centerPane.add(tabPanel, "Center"); + centerPane.add(shortcutPanel, "East"); + + // 底部添加第二个标签页面板,用于显示检查结果 + contentPanel.add(tabPanel2, BorderLayout.SOUTH); + } + + private void initTree() { + tree = shortcutPanel.mytree; + // 点击目录树节点,显示对应文件内容 + tree.setCode(textCode, this); + } + + private void initOutlookPanel() { + outlookPanel = new MyOutlookPanel(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String command = e.getActionCommand(); + System.out.println("Head:" + command); + } + + }, new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + boolean adjust = e.getValueIsAdjusting(); + if (!adjust) { + JList list = (JList) e.getSource(); + Object[] selectionValues = list.getSelectedValues(); + MyOutlookPanelListItem item = + (MyOutlookPanelListItem) selectionValues[0]; + String command = item.getActionCommand(); + if (command.equals("Chart2")) { + // 如果TabPanel不存在就create,否则就切换 + if (!tabPanel.isSelectTabComponents("结果")) { + try { + ct.makeTable(); + viewPanel = new ViewPanel(ct.results); + } catch (Exception e1) { + e1.printStackTrace(); + System.out.println("图表生成错误"); + } + tabPanel.addTab("结果", createPage(viewPanel)); + tabPanel.isSelectTabComponents("结果"); + } + } else if (command.equals("Map")) { + // 代码标签页 + if (!tabPanel.isSelectTabComponents("代码")) { + tabPanel.addTab("代码", testCode); + tabPanel.isSelectTabComponents("代码"); + } + } else if (command.equals("Process")) { + // 进度 + if (!tabPanel.isSelectTabComponents("进度")) { + tabPanel.addTab("进度", textCheck); + tabPanel.isSelectTabComponents("进度"); + } + } + } + } + + }); + // 根据XML配置文件加载Outlook面板内容 + MyContorlUtil.loadOutlookPanel(outlookPanelXML, outlookPanel); + } + + private void initTab() { + tabPanel = new MyTabPanel(); + tabPanel.addMouseListener(new MouseAdapter() { + private boolean isMaximized() { + return outlookPanel.isShrinked(); + } + + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() > 1) { + TabbedPaneUI ui = tabPanel.getUI(); + int tabIndex = + ui.tabForCoordinate(tabPanel, e.getX(), e.getY()); + if (tabIndex != -1) { + boolean maxed = isMaximized(); + outlookPanel.setShrink(!maxed); + shortcutPanel.setShrink(!maxed); + } + } + } + }); + + testCode = new MyTextPanel(); + testPanel = new MyTextPanel1(); + viewPanel = new ViewPanel(); + textCode = testCode.getTextArea(); + textCheck = testPanel.getTextArea(); + } + + private void initTab2() { + tabPanel2 = new MyTabPanel1(); + tabPanel2.addMouseListener(new MouseAdapter() { + private boolean isMaximized() { + return outlookPanel.isShrinked(); + } + + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() > 1) { + TabbedPaneUI ui = tabPanel2.getUI(); + int tabIndex = + ui.tabForCoordinate(tabPanel2, e.getX(), e.getY()); + if (tabIndex != -1) { + boolean maxed = isMaximized(); + outlookPanel.setShrink(!maxed); + shortcutPanel.setShrink(!maxed); + } + } + } + }); + + flawfinderPanel = new MyTextPanel1(); + cppcheckPanel = new MyTextPanel1(); + clangPanel = new MyTextPanel1(); + flawfinderResult = flawfinderPanel.getTextArea(); + cppcheckResult = cppcheckPanel.getTextArea(); + clangResult = clangPanel.getTextArea(); + + tabPanel2.addTab("cppcheck", createPage1(cppcheckPanel)); + tabPanel2.addTab("Clang", createPage1(clangPanel)); + tabPanel2.addTab("flawfinder", createPage1(flawfinderPanel)); + } + + private MyTabPage1 createPage1(JComponent pageContent) { + MyTabPage1 page = new MyTabPage1(pageContent); + return page; + } + + private MyTabPage createPage(JComponent pageContent) { + MyTabPage page = new MyTabPage(pageContent); + return page; + } + + //改造成目录树 + private void initShortcutPanel() throws UnsupportedEncodingException { + shortcutPanel = new MyShortcutPanel(); + shortcutPanel.setTitle( + new String("项目".getBytes(), StandardCharsets.UTF_8)); + } +} diff --git a/src/cppcheckplus/control/MyContentPanel.java b/src/cppcheckplus/control/MyContentPanel.java new file mode 100644 index 0000000..63d792a --- /dev/null +++ b/src/cppcheckplus/control/MyContentPanel.java @@ -0,0 +1,16 @@ + +package cppcheckplus.control; + +import java.awt.BorderLayout; + +import javax.swing.JPanel; + +public class MyContentPanel extends JPanel +{ + public MyContentPanel() + { + super(); + setLayout(new BorderLayout()); + setBackground(MyContorlUtil.CONTENT_PANE_BACKGROUND); + } +} diff --git a/src/cppcheckplus/control/MyContorlUtil.java b/src/cppcheckplus/control/MyContorlUtil.java new file mode 100644 index 0000000..72716de --- /dev/null +++ b/src/cppcheckplus/control/MyContorlUtil.java @@ -0,0 +1,597 @@ + +package cppcheckplus.control; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.TexturePaint; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.awt.image.PixelGrabber; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.imageio.ImageIO; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JMenuItem; +import javax.swing.UIManager; +import javax.swing.plaf.FontUIResource; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import com.jgoodies.looks.plastic.PlasticLookAndFeel; +import com.jgoodies.looks.plastic.theme.ExperienceGreen; + +import cppcheckplus.menu.MyMenu; +import cppcheckplus.menu.MyMenuBar; +import cppcheckplus.menu.MyMenuItem; +import cppcheckplus.menu.MyRootMenu; +import cppcheckplus.outlookpanel.MyOutlookBar; +import cppcheckplus.outlookpanel.MyOutlookHeader; +import cppcheckplus.outlookpanel.MyOutlookPanel; +import cppcheckplus.outlookpanel.MyOutlookPanelListItem; + + +/** + * @ClassName: ContorlUtil + * @Description: TODO(控件工具,皮肤信息和基本操作) + * + */ +public class MyContorlUtil +{ + //文本 + public static final Color DEFAULT_TEXT_COLOR = new Color(37, 81, 54); + public static final Font FONT_14_BOLD = new Font("微软雅黑", 1, 14); + public static final Font FONT_12_BOLD = new Font("微软雅黑", 1, 12); + public static final Font FONT_14_PLAIN = new Font("微软雅黑", 0, 14); + public static final Font FONT_12_PLAIN = new Font("微软雅黑", 0, 12); +// public static final Font FONT_12_PLAIN = new Font("Dialog", 0, 12); +//public static final Font FONT_12_PLAIN = new Font("Calibri", 0, 12); + //菜单 + public static final Color MENUITEM_SELECTED_BACKGROUND = new Color(166, 188, 140); + public static final Color MENUITEM_BACKGROUND = new Color(228, 235, 218); + //主面板 + public static final Color CONTENT_PANE_BACKGROUND = new Color(92, 153, 45); + public static final Color CONTENT_PANE_BACKGROUND2 = new Color(78, 238, 148); + public static final Color CONTENT_PANE_BACKGROUND3 = new Color(238, 220, 130); + //工具栏按钮 + public static final Color BUTTON_ROVER_COLOR = new Color(196, 196, 197); + //OutLook面板 + public static final Color OUTLOOK_TEXT_COLOR = new Color(120, 120, 125); + public static final Color OUTLOOK_SPLIT_COLOR = new Color(174, 171, 162); + public static final Color OUTLOOK_CONTAINER_COLOR = new Color(217, 218, 219) ;//容器的背景颜色,灰色 + //多视图Tab + public static final Color TAB_BOTTOM_LINE_COLOR = new Color(167, 173, 175); + //快捷菜单面板 + public static final Color LIST_SPLIT_COLOR = new Color(105, 113, 120); + public static final Color LIST_BACKGROUND = new Color(175, 174, 176); + public static final Color LIST_TEXT_COLOR = new Color(49, 52, 58); + //图形 + public static Font CHART_AXIS_FONT = new Font("微软雅黑",Font.PLAIN,12) ;// 坐标轴字体 + public static Font CHART_TITLE_FONT = new Font("微软雅黑",Font.PLAIN,14);//标题字体 + public static Font CHART_LEGEND_FONT = new Font("微软雅黑",Font.PLAIN,12); //图例字体 + + //其他 + public static final Color NO_COLOR = new Color(0, 0, 0, 0); + public static final Insets ZERO_INSETS = new Insets(0, 0, 0, 0); + /** + * ClassLoader获得BufferedImage,注意和getClass().getResource()的路径不同 + * 最前面不带/ + * @param @param imgPath + * @param @return 参数 + * @return Image 返回类型 + * @throws + */ + public static Image getImage(String imgPath) + { + BufferedImage img = null; + try + { + //System.out.println("图片路径: "+imgPath); + img = ImageIO.read(ClassLoader.getSystemResource(imgPath)); + } catch (IOException e) + { + System.out.println("图片路径找不到: "+imgPath); + //e.printStackTrace(); + } + return img; + } + public static ImageIcon getImageIcon(String imgPath) + { + ImageIcon icon = null; + try + { + icon = new ImageIcon(ClassLoader.getSystemResource(imgPath)); + return icon; + } + catch (Exception e) + { + System.out.println("找不到图片: " +imgPath ); + } + return icon; + } + public static Image iconToImage(Icon icon) + { + if (icon instanceof ImageIcon) + { + return ((ImageIcon) icon).getImage(); + } + else + { + int w = icon.getIconWidth(); + int h = icon.getIconHeight(); + BufferedImage image = new BufferedImage(w, h, 2); + Graphics2D g = image.createGraphics(); + icon.paintIcon(null, g, 0, 0); + g.dispose(); + return image; + } + } + public static ImageIcon createDyedIcon(ImageIcon icon, Color color) + { + if (color == null) + { + return icon; + } + else + { + int iconWidth = icon.getIconWidth(); + int iconHeight = icon.getIconHeight(); + BufferedImage bi = new BufferedImage(iconWidth, iconHeight, 2); + Graphics2D g2d = bi.createGraphics(); + icon.paintIcon(null, g2d, 0, 0); + g2d.dispose(); + Image dyedImage = createDyedImage(bi, color); + return new ImageIcon(dyedImage); + } + } + public static Image createDyedImage(Image image, Color color) + { + if (color == null) + return image; + if (image != null) + { + int w = image.getWidth(null); + int h = image.getHeight(null); + int pixels[] = new int[w * h]; + PixelGrabber pg = new PixelGrabber(image, 0, 0, w, h, pixels, 0, w); + try + { + pg.grabPixels(); + } + catch (InterruptedException ex) + { + ex.printStackTrace(); + return null; + } + BufferedImage bi = new BufferedImage(w <= 1 ? 1 : w, + h <= 1 ? 1 : h, 2); + for (int i = 0; i < pixels.length; i++) + { + int pixel = pixels[i]; + int row = i / w; + int col = i % w; + if (color != null && pixel != 0) + pixel = color.getRGB(); + bi.setRGB(col, row, pixel); + } + return bi; + } + else + { + return null; + } + } + public static Icon createMovedIcon(Icon icon) + { + return createMovedIcon(icon, 1, 1); + } + public static Icon createMovedIcon(final Icon icon, final int offsetX, + final int offsetY) + { + return new Icon() + { + public void paintIcon(Component c, Graphics g, int x, int y) + { + icon.paintIcon(c, g, x + offsetX, y + offsetY); + } + public int getIconWidth() + { + return icon.getIconWidth(); + } + public int getIconHeight() + { + return icon.getIconHeight(); + } + }; + } + + public static TexturePaint createTexturePaint(String imgPath) + { + ImageIcon icon = getImageIcon(imgPath); + int imageWidth = icon.getIconWidth(); + int imageHeight = icon.getIconHeight(); + BufferedImage bi = new BufferedImage(imageWidth, imageHeight, 2); + Graphics2D g2d = bi.createGraphics(); + g2d.drawImage(icon.getImage(), 0, 0, null); + g2d.dispose(); + return new TexturePaint(bi, + new Rectangle(0, 0, imageWidth, imageHeight)); + } + + public static Color getColor(String color) { + Color convertedColor = Color.ORANGE; + try { + convertedColor = new Color(Integer.parseInt(color, 16)); + } catch(NumberFormatException e) { + String error = String.format("颜色转化出错:s%",color); + System.out.println(error); + } + return convertedColor; + } + + public static InputStream getXMLFile(String filePath) + { + return ClassLoader.getSystemResourceAsStream(filePath); + } + + + public static String getStringAttribute(org.w3c.dom.Node node, String name) + { + org.w3c.dom.Node attribute = node.getAttributes().getNamedItem(name); + if (attribute != null) + return attribute.getNodeValue(); + else + return null; + } + + private static Icon getIconAttribute(org.w3c.dom.Node node, String name) + { + String iconURL = getStringAttribute(node, name); + if (iconURL != null && !iconURL.isEmpty()) + return getImageIcon(iconURL); + else + return null; + } + + private static int getIntAttribute(org.w3c.dom.Node node, String name) + { + String value = getStringAttribute(node, name); + if (value != null && !value.isEmpty()) + return Integer.valueOf(value).intValue(); + else + return 0; + } + + public static MyMenuBar loadMenuBar(String xml, ActionListener action) + { + MyMenuBar menuBar = null; + try + { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(MyContorlUtil.getXMLFile(xml)); + Element root = doc.getDocumentElement(); + NodeList rootMenus = root.getChildNodes(); + if (rootMenus != null) + { + menuBar = new MyMenuBar(); + for (int i = 0; i < rootMenus.getLength(); i++) + { + org.w3c.dom.Node menu = rootMenus.item(i); + if (menu.getNodeType() == Node.ELEMENT_NODE) + { + if (menu.getNodeName().equalsIgnoreCase("menu")) + { + String text = MyContorlUtil.getStringAttribute(menu, "text"); + MyRootMenu rootMenu = new MyRootMenu(); + rootMenu.setText(text); + menuBar.add(rootMenu); + processMenuItem(menu, rootMenu, action); + } + if (menu.getNodeName().equalsIgnoreCase("logo")) + { + String tooltip = MyContorlUtil.getStringAttribute(menu, "tooltip"); + String imageURL = MyContorlUtil.getStringAttribute(menu, "image"); + menuBar.add(Box.createGlue()); + JLabel label = new JLabel(MyContorlUtil.getImageIcon(imageURL)); + label.setBorder(BorderFactory.createEmptyBorder(0,5, 0, 5)); + label.setToolTipText(tooltip); + menuBar.add(label); + } + } + } + } + } + catch (Exception ex) + { + ex.printStackTrace(); + } + return menuBar; + } + + + public static void fixSettingPath(String xml, String tool, String newPath) + { + try + { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(MyContorlUtil.getXMLFile(xml)); + Element root = doc.getDocumentElement(); + NodeList tools = root.getChildNodes(); + if (tools != null) + { + for (int i = 0; i < tools.getLength(); i++) + { + org.w3c.dom.Node menu = tools.item(i); + if (menu.getNodeType() == Node.ELEMENT_NODE) + { + if (menu.getNodeName().equalsIgnoreCase("tool")) + { + org.w3c.dom.Node att = menu.getAttributes().getNamedItem("id"); + String toolName = MyContorlUtil.getStringAttribute(menu, "toolName"); + if(tool.equals("cppcheck") && toolName.equals("cppcheck") ){ + org.w3c.dom.Node attribute = menu.getAttributes().getNamedItem("filePath"); + if (attribute != null) + attribute.setNodeValue(newPath.replaceAll("\\\\","\\/")); + } + else if(tool.equals("flawfinder") && toolName.equals("flawfinder")){ + org.w3c.dom.Node attribute = menu.getAttributes().getNamedItem("filePath"); + if (attribute != null) + attribute.setNodeValue(newPath.replaceAll("\\\\","\\/")); + } + } + } + } + } + + Transformer transformer=TransformerFactory.newInstance().newTransformer(); + DOMSource source=new DOMSource(doc); + File file =new File(ClassLoader.getSystemResource(xml).toURI()); + FileOutputStream outstream =new FileOutputStream("src/cppcheckplus/control/settings.xml"); + StreamResult reslut=new StreamResult(outstream); + transformer.transform(source, reslut); + outstream.close(); + + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + } + + public static void loadToolsRoad(String xml, Main main) + { + try + { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(MyContorlUtil.getXMLFile(xml)); + Element root = doc.getDocumentElement(); + NodeList tools = root.getChildNodes(); + if (tools != null) + { + for (int i = 0; i < tools.getLength(); i++) + { + org.w3c.dom.Node menu = tools.item(i); + if (menu.getNodeType() == Node.ELEMENT_NODE) + { + if (menu.getNodeName().equalsIgnoreCase("tool")) + { + String toolName = MyContorlUtil.getStringAttribute(menu, "toolName"); + String filePath = MyContorlUtil.getStringAttribute(menu, "filePath"); + String para= MyContorlUtil.getStringAttribute(menu, "para"); + if(toolName.equals("cppcheck")){ + main.cppcheckPath=filePath; + main.paracppcheck=para; + } + else if(toolName.equals("flawfinder")){ + main.flawfinderPath=filePath; + main.paraflawfinder=para; + } + } + } + } + } + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + + + private static void processMenuItem(org.w3c.dom.Node menu, + JMenuItem parentMenu, ActionListener action) + { + NodeList children = menu.getChildNodes(); + if (children != null) + { + for (int j = 0; j < children.getLength(); j++) + { + org.w3c.dom.Node itemNode = children.item(j); + if (itemNode.getNodeType() != Node.ELEMENT_NODE) + continue; + boolean isMenuItem = itemNode.getNodeName().equalsIgnoreCase( + "menuitem"); + boolean isMenu = itemNode.getNodeName() + .equalsIgnoreCase("menu"); + if (!isMenuItem && !isMenu) + continue; + String text = getStringAttribute(itemNode, "text"); + String tooltip = getStringAttribute(itemNode, "tooltip"); + Icon icon = getIconAttribute(itemNode, "icon"); + String command = getStringAttribute(itemNode, "action"); + JMenuItem menuItem = null; + if (isMenu) + { + menuItem = new MyMenu(); + } + else + { + menuItem = new MyMenuItem(); + menuItem.addActionListener(action); + } + menuItem.setText(text); + menuItem.setToolTipText(tooltip); + menuItem.setActionCommand(command); + menuItem.setIcon(icon); + parentMenu.add(menuItem); + if (isMenu) + processMenuItem(itemNode, menuItem, action); + } + } + } + + //加载OutloolPanel上的最上面的快捷工具栏OutlookHeader + public static void loadOutlookToolBar(String xml, MyOutlookHeader header, + ActionListener action) + { + try + { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(getXMLFile(xml)); + Element root = doc.getDocumentElement(); + NodeList buttons = root.getChildNodes(); + if (buttons != null) + { + for (int i = 0; i < buttons.getLength(); i++) + { + org.w3c.dom.Node buttonNode = buttons.item(i); + if (buttonNode.getNodeType() == Node.ELEMENT_NODE) + { + if (buttonNode.getNodeName().equalsIgnoreCase("button")) + { + String tooltip = getStringAttribute(buttonNode, + "tooltip"); + Icon icon = getIconAttribute(buttonNode, "icon"); + String command = getStringAttribute(buttonNode, + "action"); + header.addButton(icon, tooltip, action, command); + } + if (buttonNode.getNodeName().equalsIgnoreCase( + "separator")) + header.addSeparator(); + } + } + } + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + public static void loadOutlookPanel(String xml, MyOutlookPanel outlookPane) + { + try + { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(getXMLFile(xml)); + Element root = doc.getDocumentElement(); + NodeList modules = root.getChildNodes(); + if (modules != null) + { + for (int i = 0; i < modules.getLength(); i++) + { + org.w3c.dom.Node moduleNode = modules.item(i); + if (moduleNode.getNodeType() == Node.ELEMENT_NODE + && moduleNode.getNodeName().equalsIgnoreCase( + "module")) + { + String text = getStringAttribute(moduleNode, "text"); + Icon icon = getIconAttribute(moduleNode, "icon"); + Icon iconSelected = getIconAttribute(moduleNode, + "selected_icon"); + MyOutlookBar bar = outlookPane.addBar(text, icon, + iconSelected,getOutlookPanelSubModules(moduleNode)); + } + } + } + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + private static MyOutlookPanelListItem[] getOutlookPanelSubModules(Node moduleNode) + { + List listItemList = new ArrayList(); + if(moduleNode != null) + { + NodeList subModules = moduleNode.getChildNodes(); + for (int i = 0; i < subModules.getLength(); i++) + { + Node subNode = subModules.item(i); + if( (subNode.getNodeType() == Node.ELEMENT_NODE) && (subNode.getNodeName().equalsIgnoreCase("submodule")) ) + { + MyOutlookPanelListItem item = new MyOutlookPanelListItem(); + item.setIcon(getIconAttribute(subNode, "icon")); + item.setText(getStringAttribute(subNode,"text")); + item.setToolTip(getStringAttribute(subNode, "tooltip")); + item.setActionCommand(getStringAttribute(subNode, "action")); + listItemList.add(item); + } + } + } + MyOutlookPanelListItem[] items = new MyOutlookPanelListItem[listItemList.size()]; + return listItemList.toArray(items); + } + + public static void setupLookAndFeel() + { + //Locale.setDefault(new Locale("EN_US")); + com.jgoodies.looks.plastic.PlasticTheme theme = new ExperienceGreen() + { + public FontUIResource getControlTextFont() + { + return new FontUIResource(new Font("微软雅黑", 0, 11)); + } + }; + PlasticLookAndFeel.setPlasticTheme(theme); + try + { + UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel"); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + UIManager.put("Menu.selectionBackground", MyContorlUtil.NO_COLOR); + UIManager.put("MenuItem.selectionBackground",MyContorlUtil.MENUITEM_SELECTED_BACKGROUND); + // UIManager.put("PopupMenu.border", new FreePopupMenuBorder()); + UIManager.put("ToolTip.font", MyContorlUtil.FONT_14_BOLD); + UIManager.put("TabbedPane.contentBorderInsets", MyContorlUtil.ZERO_INSETS); + UIManager.put("TabbedPane.tabInsets", MyContorlUtil.ZERO_INSETS); + UIManager.put("TabbedPane.selectedTabPadInsets", MyContorlUtil.ZERO_INSETS); + UIManager.put("TabbedPane.tabAreaInsets", MyContorlUtil.ZERO_INSETS); + } +} diff --git a/src/cppcheckplus/control/MyHeader.java b/src/cppcheckplus/control/MyHeader.java new file mode 100644 index 0000000..1b71704 --- /dev/null +++ b/src/cppcheckplus/control/MyHeader.java @@ -0,0 +1,201 @@ + +package cppcheckplus.control; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.TexturePaint; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.BorderFactory; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.border.Border; + + + +public class MyHeader extends JPanel +{ + public static final ImageIcon RIGHT_ARROW_ICON = MyContorlUtil.getImageIcon("control/images/shrink_handler_right.png"); + public static final ImageIcon LEFT_ARROW_ICON = MyContorlUtil.getImageIcon("control/images/shrink_handler_left.png"); + private Color titleColor; + private boolean shrinked; + private ImageIcon backgroundImageIcon; + private Image backgroundLeftImage; + private Image backgroundRightImage; + private TexturePaint paint; + private int preferredHeight; + private JLabel lbResizeHandler; + private JLabel lbShrinkHandler; + private JLabel lbTitle; + private int normalPreferredWidth; + private MyListSplitListener splitListener; + private MouseListener shrinkListener; + + public MyHeader() + { + super(); + titleColor = new Color(215, 215, 216); + shrinked = false; + backgroundImageIcon = MyContorlUtil.getImageIcon("control/images/header_background.png"); + backgroundLeftImage = MyContorlUtil.getImage("control/images/header_background_left.png"); + backgroundRightImage = MyContorlUtil.getImage("control/images/header_background_right.png"); + paint = MyContorlUtil.createTexturePaint("control/images/header_background.png"); + preferredHeight = backgroundImageIcon.getIconHeight(); + lbResizeHandler = new JLabel(MyContorlUtil.getImageIcon("control/images/resize_handler.png")); + lbShrinkHandler = new JLabel(getShrinkIcon(shrinked)); + lbTitle = new JLabel(); + normalPreferredWidth = 0; + splitListener = createSplitListener(); + shrinkListener = new MouseAdapter() { + public void mouseClicked(MouseEvent e) + { + changeShrink(); + } + }; + init(); + } + + protected MyListSplitListener createSplitListener() + { + return new MyListSplitListener(this); + } + + protected Border createBorder() + { + return BorderFactory.createEmptyBorder(4, 7, 0, 0); + } + + private void init() + { + setBorder(createBorder()); + setOpaque(false); + setLayout(new BorderLayout()); + add(lbResizeHandler, getResizeHandlerLayoutConstraint()); + add(lbShrinkHandler, getShrinkHandlerLayoutConstraint()); + JComponent centerComponent = getCenterComponent(); + if (centerComponent != null) + add(centerComponent, "Center"); + lbResizeHandler.addMouseMotionListener(splitListener); + lbResizeHandler.addMouseListener(splitListener); + lbShrinkHandler.addMouseListener(shrinkListener); + lbTitle.setFont(MyContorlUtil.FONT_14_BOLD); + lbTitle.setForeground(titleColor); + lbTitle.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 0)); + updateCursor(); + lbShrinkHandler.setBorder(BorderFactory.createEmptyBorder(0, 8, 2, 5)); + } + + protected JComponent getCenterComponent() + { + return lbTitle; + } + + protected Object getResizeHandlerLayoutConstraint() + { + return "West"; + } + + protected Object getShrinkHandlerLayoutConstraint() + { + return "East"; + } + + protected void paintComponent(Graphics g) + { + Graphics2D g2d = (Graphics2D)g; + g2d.setPaint(paint); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.drawImage(backgroundLeftImage, 0, 0, null); + int x = getWidth() - backgroundRightImage.getWidth(null); + int y = 0; + g2d.drawImage(backgroundRightImage, x, y, null); + } + + public Dimension getPreferredSize() + { + return new Dimension(super.getPreferredSize().width, preferredHeight); + } + + public void revalidateParent() + { + if (getParent() instanceof JComponent) + ((JComponent)getParent()).revalidate(); + } + + public void changeShrink() + { + setShrink(!isShrinked()); + } + + public void setShrink(boolean shrinked) + { + if (shrinked != this.shrinked) + { + Container parent = getParent(); + Dimension size = parent.getPreferredSize(); + if (shrinked) + { + normalPreferredWidth = size.width; + size = new Dimension(getShrinkedWidth(), size.height); + } else + { + int width = normalPreferredWidth; + int height = parent.getPreferredSize().height; + size = new Dimension(width, height); + } + parent.setPreferredSize(size); + lbShrinkHandler.setIcon(getShrinkIcon(shrinked)); + revalidateParent(); + this.shrinked = shrinked; + updateCursor(); + lbTitle.setVisible(!shrinked); + lbResizeHandler.setVisible(!shrinked); + } + } + + protected ImageIcon getShrinkIcon(boolean shrinked) + { + if (shrinked) + return LEFT_ARROW_ICON; + else + return RIGHT_ARROW_ICON; + } + + private void updateCursor() + { + if (shrinked) + lbResizeHandler.setCursor(Cursor.getDefaultCursor()); + else + lbResizeHandler.setCursor(Cursor.getPredefinedCursor(10)); + } + + public boolean isShrinked() + { + return shrinked; + } + + public void setTitle(String title) + { + lbTitle.setText(title); + } + + public String getTitle() + { + return lbTitle.getText(); + } + + protected int getShrinkedWidth() + { + return 37; + } +} diff --git a/src/cppcheckplus/control/MyList.java b/src/cppcheckplus/control/MyList.java new file mode 100644 index 0000000..2a577ff --- /dev/null +++ b/src/cppcheckplus/control/MyList.java @@ -0,0 +1,68 @@ + +package cppcheckplus.control; + +import java.awt.event.MouseEvent; + +import javax.swing.JList; +import javax.swing.event.MouseInputAdapter; +import javax.swing.event.MouseInputListener; + +import cppcheckplus.shortcut.MyShortcutItem; +import cppcheckplus.shortcut.MyShortcutItemClickListenter; + + +public class MyList extends JList +{ + private MyShortcutItemClickListenter clickListenter; + + public MyList() + { + init(); + } + public void setListenter(MyShortcutItemClickListenter itemClickListenter) + { + this.clickListenter = itemClickListenter; + MouseInputListener listener = new MouseInputAdapter() + { + //通过Move设置Item为selected,从而触发渲染器处理,实现高亮 + @Override + public void mouseMoved(MouseEvent e) + { + int moveIndex = locationToIndex(e.getPoint()); + setSelectedIndex(moveIndex); + } + //移动出去之后,清除选中,从而触发渲染器 + @Override + public void mouseExited(MouseEvent e) + { + getSelectionModel().clearSelection(); + } + + @Override + public void mouseClicked(MouseEvent e) + { + //因为该JList是单选模式,所以取第一个选择的就可以了 + Object selObj = getSelectedValue(); + if(selObj != null) + { + MyShortcutItem item = (MyShortcutItem)selObj; + if(!item.isGroup()) + { + clickListenter.ItemClick(item.getActionCommand()); + } + } + //itemClick.ItemClick(actionCommand) + } + }; + addMouseMotionListener(listener); + addMouseListener(listener); + } + private void init() + { + setFont(MyContorlUtil.FONT_12_BOLD); + setForeground(MyContorlUtil.DEFAULT_TEXT_COLOR); + setBackground(MyContorlUtil.LIST_BACKGROUND); + setCellRenderer(new MyListRenderer(this)); + setSelectionMode(0); + } +} diff --git a/src/cppcheckplus/control/MyListRenderer.java b/src/cppcheckplus/control/MyListRenderer.java new file mode 100644 index 0000000..1495378 --- /dev/null +++ b/src/cppcheckplus/control/MyListRenderer.java @@ -0,0 +1,138 @@ + +package cppcheckplus.control; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.OverlayLayout; + +import cppcheckplus.shortcut.MyShortcutItem; +import cppcheckplus.shortcut.MyShortcutPanel; + +//快捷菜单 +public class MyListRenderer extends DefaultListCellRenderer +{ + private JPanel itemRender; + private int separatorHeight = 30; + //每组List的分割Group + private JPanel separatorPanel; + private JLabel separatorLabel; + private MySeparator separator; + private Color itemTextColor; + private Color separatorTextColor; + private Color itemSelectedBackground; + private Color itemSelectedBorder; + private Font separatorFont; + + public MyListRenderer(MyList list) + { + super(); + itemRender = new JPanel(new BorderLayout()); + separatorPanel = new JPanel() { + + public Dimension getPreferredSize() + { + Dimension size = super.getPreferredSize(); + return new Dimension(size.width, separatorHeight); + } + + }; + //分割Group的样式 + separatorLabel = new JLabel(); + separator = new MySeparator(0); + separatorTextColor = Color.white; + separatorFont = MyContorlUtil.FONT_12_BOLD; + + itemTextColor = MyContorlUtil.LIST_TEXT_COLOR; + itemSelectedBackground = new Color(199, 198, 200); + itemSelectedBorder = new Color(163, 163, 163); + itemRender.setOpaque(false); + itemRender.add(this, "Center"); + separatorPanel.setLayout(new OverlayLayout(separatorPanel)); + JPanel separatorHelpPane = new JPanel(new BorderLayout()); + separatorHelpPane.setBorder(BorderFactory.createEmptyBorder(12, 0, 0, 0)); + separatorHelpPane.add(separator); + separatorHelpPane.setOpaque(false); + separatorPanel.setOpaque(false); + separatorLabel.setOpaque(true); + separatorLabel.setBackground(MyContorlUtil.LIST_BACKGROUND); + separatorLabel.setForeground(separatorTextColor); + separatorLabel.setFont(separatorFont); + separatorLabel.setVerticalAlignment(1); + separatorLabel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); + JPanel labelHelpPane = new JPanel(new BorderLayout()); + labelHelpPane.setBorder(BorderFactory.createEmptyBorder(6, 15, 0, 0)); + labelHelpPane.add(separatorLabel, "West"); + labelHelpPane.setOpaque(false); + separatorPanel.add(labelHelpPane); + separatorPanel.add(separatorHelpPane); + } + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) + { + MyShortcutItem shortcutItem = (MyShortcutItem)value; + //Group的渲染 + if(shortcutItem.isGroup()) + { + String groupName = shortcutItem.getText(); + separatorLabel.setText(groupName); + separatorPanel.setToolTipText(groupName); + if (list.getParent() instanceof MyShortcutPanel) + { + MyShortcutPanel pane = (MyShortcutPanel)list.getParent(); + if (pane.isShrinked()) + { + separatorLabel.setText(" "); + separatorLabel.setOpaque(false); + } else + { + separatorLabel.setOpaque(true); + } + } + return separatorPanel; + } + //普通Item的渲染 + else + { + setText(shortcutItem.getText()); + setBackground(MyContorlUtil.LIST_BACKGROUND); + setToolTipText(shortcutItem.getToolTip()); + setIcon(shortcutItem.getIcon()); + } + + //判断List的父容器是否是快捷菜单面板,如果是,需要考虑收缩展开的处理 + if (list.getParent() instanceof MyShortcutPanel) + { + MyShortcutPanel pane = (MyShortcutPanel)list.getParent(); + if (pane.isShrinked()) + { + setBorder(BorderFactory.createEmptyBorder(2, 7, 1, 2)); + setText(""); + } else + { + setBorder(BorderFactory.createEmptyBorder(2, 20, 1, 2)); + } + } + if (isSelected) + { + setBackground(itemSelectedBackground); + itemRender.setBorder(BorderFactory.createLineBorder(itemSelectedBorder)); + } + else + { + itemRender.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); + } + setForeground(itemTextColor); + + return itemRender; + } + +} diff --git a/src/cppcheckplus/control/MyListSplitListener.java b/src/cppcheckplus/control/MyListSplitListener.java new file mode 100644 index 0000000..4ee8fea --- /dev/null +++ b/src/cppcheckplus/control/MyListSplitListener.java @@ -0,0 +1,50 @@ + +package cppcheckplus.control; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.MouseEvent; + +import javax.swing.JComponent; +import javax.swing.event.MouseInputAdapter; + + +public class MyListSplitListener extends MouseInputAdapter +{ + protected Point lastPoint; + protected MyHeader header; + + public MyListSplitListener(MyHeader header) + { + lastPoint = null; + this.header = null; + this.header = header; + } + + public void mousePressed(MouseEvent e) + { + if (!header.isShrinked()) + lastPoint = e.getPoint(); + } + + public void mouseReleased(MouseEvent e) + { + lastPoint = null; + } + + public void mouseDragged(MouseEvent e) + { + if (!header.isShrinked() && lastPoint != null) + { + JComponent parent = (JComponent)header.getParent(); + Dimension size = parent.getPreferredSize(); + Point thisPoint = e.getPoint(); + int xMovement = thisPoint.x - lastPoint.x; + size.width -= xMovement; + size.width = Math.max(size.width, 37); + parent.setPreferredSize(size); + header.revalidateParent(); + } + } + +} diff --git a/src/cppcheckplus/control/MySeparator.java b/src/cppcheckplus/control/MySeparator.java new file mode 100644 index 0000000..f5ba4ad --- /dev/null +++ b/src/cppcheckplus/control/MySeparator.java @@ -0,0 +1,40 @@ + +package cppcheckplus.control; + +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.TexturePaint; + +import javax.swing.JSeparator; + + +public class MySeparator extends JSeparator +{ + private Image image; + private TexturePaint paint; + + public MySeparator() + { + image = MyContorlUtil.getImage("control/images/separator_background.png"); + paint = MyContorlUtil.createTexturePaint("control/images/separator_background.png"); + } + + public MySeparator(int direction) + { + super(direction); + image = MyContorlUtil.getImage("control/images/separator_background.png"); + paint = MyContorlUtil.createTexturePaint("control/images/separator_background.png"); + } + + public void paintComponent(Graphics g) + { + Graphics2D g2d = (Graphics2D)g; + g2d.setPaint(paint); + int x = 0; + int y = 0; + int width = getWidth(); + int height = image.getHeight(null); + g2d.fillRect(x, y, width, height); + } +} diff --git a/src/cppcheckplus/control/MyTextField.java b/src/cppcheckplus/control/MyTextField.java new file mode 100644 index 0000000..d0ed080 --- /dev/null +++ b/src/cppcheckplus/control/MyTextField.java @@ -0,0 +1,62 @@ + +package cppcheckplus.control; + +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.TexturePaint; + +import javax.swing.BorderFactory; +import javax.swing.ImageIcon; +import javax.swing.JTextField; +import javax.swing.border.Border; +import javax.swing.plaf.metal.MetalTextFieldUI; + + +public class MyTextField extends JTextField +{ + private Image backgroundLeftImage; + private Image backgroundRightImage; + private ImageIcon backgroundImageIcon; + private TexturePaint paint; + private Border border; + + public MyTextField() + { + backgroundLeftImage = MyContorlUtil.getImage("control/images/textfield_background_left.png"); + backgroundRightImage = MyContorlUtil.getImage("control/images/textfield_background_right.png"); + backgroundImageIcon = MyContorlUtil.getImageIcon("control/images/textfield_background.png"); + paint = MyContorlUtil.createTexturePaint("control/images/textfield_background.png"); + border = BorderFactory.createEmptyBorder(1, 3, 1, 3); + init(); + } + public MyTextField(String text) + { + this(); + setText(text); + } + + private void init() + { + setBorder(border); + setUI(new MetalTextFieldUI() { + + protected void paintBackground(Graphics g) + { + Graphics2D g2d = (Graphics2D)g; + g2d.setPaint(paint); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.drawImage(backgroundLeftImage, 0, 0, null); + g2d.drawImage(backgroundRightImage, getWidth() - backgroundRightImage.getWidth(null), 0, null); + } + + }); + } + + public Dimension getPreferredSize() + { + return new Dimension(super.getPreferredSize().width, backgroundImageIcon.getIconHeight()); + } + +} diff --git a/src/cppcheckplus/control/MyToolbarButton.java b/src/cppcheckplus/control/MyToolbarButton.java new file mode 100644 index 0000000..e709296 --- /dev/null +++ b/src/cppcheckplus/control/MyToolbarButton.java @@ -0,0 +1,96 @@ + +package cppcheckplus.control; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.border.Border; + +public class MyToolbarButton extends JButton +{ + private int buttonSize; + private Color roverBorderColor; + private Border roverBorder; + private Border emptyBorder; + + public MyToolbarButton() + { + super(); + buttonSize = 20; + roverBorderColor = MyContorlUtil.BUTTON_ROVER_COLOR; + roverBorder = new Border() { + + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) + { + g.setColor(roverBorderColor); + g.drawRect(x, y, width - 1, height - 1); + } + + public Insets getBorderInsets(Component c) + { + return new Insets(1, 1, 1, 1); + } + + public boolean isBorderOpaque() + { + return true; + } + }; + emptyBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1); + init(); + } + + private void init() + { + setVerticalAlignment(0); + setFont(MyContorlUtil.FONT_12_BOLD); + setOpaque(false); + setBorder(emptyBorder); + setContentAreaFilled(false); + setFocusPainted(false); + addMouseListener(new MouseAdapter() { + public void mouseEntered(MouseEvent e) + { + setBorder(roverBorder); + } + + public void mouseExited(MouseEvent e) + { + setBorder(emptyBorder); + } + }); + } + + @Override + public void setIcon(Icon icon) + { + super.setIcon(icon); + if (icon == null) + { + setPressedIcon(null); + setRolloverIcon(null); + } else + { + Icon pressedIcon = MyContorlUtil.createMovedIcon(icon); + setPressedIcon(pressedIcon); + } + } + + + @Override + public Dimension getPreferredSize() + { + int width = super.getPreferredSize().width; + width = Math.max(width, buttonSize); + int height = buttonSize; + return new Dimension(width, height); + } +} diff --git a/src/cppcheckplus/control/XChartletFullScreenListenter.java b/src/cppcheckplus/control/XChartletFullScreenListenter.java new file mode 100644 index 0000000..c7eca34 --- /dev/null +++ b/src/cppcheckplus/control/XChartletFullScreenListenter.java @@ -0,0 +1,10 @@ + +package cppcheckplus.control; + +import javax.swing.JPanel; + + +public interface XChartletFullScreenListenter +{ + public void fullScreen(JPanel chartPanellet); +} diff --git a/src/cppcheckplus/control/menubar.xml b/src/cppcheckplus/control/menubar.xml new file mode 100644 index 0000000..f2d2f19 --- /dev/null +++ b/src/cppcheckplus/control/menubar.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/cppcheckplus/control/outlook.xml b/src/cppcheckplus/control/outlook.xml new file mode 100644 index 0000000..b7a5460 --- /dev/null +++ b/src/cppcheckplus/control/outlook.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/cppcheckplus/control/settings.xml b/src/cppcheckplus/control/settings.xml new file mode 100644 index 0000000..6e809a5 --- /dev/null +++ b/src/cppcheckplus/control/settings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/cppcheckplus/control/shortcuts.xml b/src/cppcheckplus/control/shortcuts.xml new file mode 100644 index 0000000..6591a60 --- /dev/null +++ b/src/cppcheckplus/control/shortcuts.xml @@ -0,0 +1,17 @@ + + +