From f604e0bacd8a54223c23d5d7a438ab32be11759f Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 16 Jan 2011 07:15:11 +0000 Subject: [PATCH] Add spacers to the main toolbar Originally committed to SVN as r5194. --- aegisub/src/include/aegisub/toolbar.h | 1 + aegisub/src/libresrc/default_toolbar.json | 24 +++++++++++++++++++++++ aegisub/src/toolbar.cpp | 7 +++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/aegisub/src/include/aegisub/toolbar.h b/aegisub/src/include/aegisub/toolbar.h index f46116f3f..4c12d8f5f 100644 --- a/aegisub/src/include/aegisub/toolbar.h +++ b/aegisub/src/include/aegisub/toolbar.h @@ -53,6 +53,7 @@ private: enum ToolbarTypes { Standard = 1, + Spacer = 100 }; void BuildToolbar(wxToolBar *toolbar, const json::Array& array); diff --git a/aegisub/src/libresrc/default_toolbar.json b/aegisub/src/libresrc/default_toolbar.json index d192125a4..02300a512 100644 --- a/aegisub/src/libresrc/default_toolbar.json +++ b/aegisub/src/libresrc/default_toolbar.json @@ -12,6 +12,9 @@ "type" : 1, "command" : "subtitle/save" }, + { + "type" : 100 + }, { "type" : 1, "command" : "video/jump" @@ -32,6 +35,9 @@ "type" : 1, "command" : "video/jump/end" }, + { + "type" : 100 + }, { "type" : 1, "command" : "time/snap/start_video" @@ -52,6 +58,9 @@ "type" : 1, "command" : "time/snap/frame" }, + { + "type" : 100 + }, { "type" : 1, "command" : "tool/style/manager" @@ -68,14 +77,23 @@ "type" : 1, "command" : "tool/font_collector" }, + { + "type" : 100 + }, { "type" : 1, "command" : "am/manager" }, + { + "type" : 100 + }, { "type" : 1, "command" : "tool/assdraw" }, + { + "type" : 100 + }, { "type" : 1, "command" : "time/shift" @@ -104,6 +122,9 @@ "type" : 1, "command" : "subtitle/spellcheck" }, + { + "type" : 100 + }, { "type" : 1, "command" : "app/options" @@ -111,6 +132,9 @@ { "type" : 1, "command" : "grid/tag/cycle_hiding" + }, + { + "type" : 100 } ] } diff --git a/aegisub/src/toolbar.cpp b/aegisub/src/toolbar.cpp index 8bd23b5c4..73f298d0d 100644 --- a/aegisub/src/toolbar.cpp +++ b/aegisub/src/toolbar.cpp @@ -71,8 +71,11 @@ void Toolbar::BuildToolbar(wxToolBar *toolbar, const json::Array& array) { for (json::Array::const_iterator index(array.Begin()); index != array.End(); index++) { const json::Object& obj = *index; - const json::Number& type_number = obj["type"]; - int type = type_number.Value(); + int type = static_cast(obj["type"]).Value(); + if (type == Toolbar::Spacer) { + toolbar->AddSeparator(); + continue; + } const json::String& command = obj["command"]; cmd::Command *cmd = cmd::get(command.Value());