/[svn]/gigedit/trunk/src/gigedit/scripteditor.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/scripteditor.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2899 by schoenebeck, Mon May 2 14:36:40 2016 UTC revision 2903 by schoenebeck, Tue May 3 14:08:34 2016 UTC
# Line 108  ScriptEditor::ScriptEditor() : Line 108  ScriptEditor::ScriptEditor() :
108      m_warningTag->property_background() = "#fffd7c"; // yellow      m_warningTag->property_background() = "#fffd7c"; // yellow
109      m_tagTable->add(m_warningTag);      m_tagTable->add(m_warningTag);
110    
111        // create menu
112        m_actionGroup = Gtk::ActionGroup::create();
113        m_actionGroup->add(Gtk::Action::create("MenuScript", _("_Script")));
114        m_actionGroup->add(Gtk::Action::create("Apply", _("_Apply")),
115                           Gtk::AccelKey("<control>s"),
116                           sigc::mem_fun(*this, &ScriptEditor::onButtonApply));
117        m_actionGroup->add(Gtk::Action::create("Close", _("_Close")),
118                           Gtk::AccelKey("<control>q"),
119                           sigc::mem_fun(*this, &ScriptEditor::onButtonCancel));
120        m_uiManager = Gtk::UIManager::create();
121        m_uiManager->insert_action_group(m_actionGroup);
122        add_accel_group(m_uiManager->get_accel_group());
123        m_uiManager->add_ui_from_string(
124            "<ui>"
125            "  <menubar name='MenuBar'>"
126            "    <menu action='MenuScript'>"
127            "      <menuitem action='Apply'/>"
128            "      <separator/>"
129            "      <menuitem action='Close'/>"
130            "    </menu>"
131            "  </menubar>"
132            "</ui>"
133        );
134    
135      m_textBuffer = Gtk::TextBuffer::create(m_tagTable);      m_textBuffer = Gtk::TextBuffer::create(m_tagTable);
136      m_textView.set_buffer(m_textBuffer);      m_textView.set_buffer(m_textBuffer);
137      {      {
# Line 126  ScriptEditor::ScriptEditor() : Line 150  ScriptEditor::ScriptEditor() :
150      }      }
151      m_scrolledWindow.add(m_textView);      m_scrolledWindow.add(m_textView);
152      m_scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);      m_scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
153    
154        Gtk::Widget* menuBar = m_uiManager->get_widget("/MenuBar");
155        m_vbox.pack_start(*menuBar, Gtk::PACK_SHRINK);
156      m_vbox.pack_start(m_scrolledWindow);      m_vbox.pack_start(m_scrolledWindow);
157    
158      m_buttonBox.set_layout(Gtk::BUTTONBOX_END);      m_buttonBox.set_layout(Gtk::BUTTONBOX_END);
# Line 134  ScriptEditor::ScriptEditor() : Line 161  ScriptEditor::ScriptEditor() :
161      m_applyButton.set_can_default();      m_applyButton.set_can_default();
162      m_applyButton.set_sensitive(false);      m_applyButton.set_sensitive(false);
163      m_applyButton.grab_focus();      m_applyButton.grab_focus();
164        
165    #if GTKMM_MAJOR_VERSION >= 3
166      m_statusImage.set_margin_left(6);      m_statusImage.set_margin_left(6);
167      m_statusImage.set_margin_right(6);      m_statusImage.set_margin_right(6);
168    #else
169        m_statusHBox.set_spacing(6);
170    #endif
171    
172      m_statusHBox.pack_start(m_statusImage, Gtk::PACK_SHRINK);      m_statusHBox.pack_start(m_statusImage, Gtk::PACK_SHRINK);
173      m_statusHBox.pack_start(m_statusLabel);      m_statusHBox.pack_start(m_statusLabel);
# Line 176  ScriptEditor::ScriptEditor() : Line 207  ScriptEditor::ScriptEditor() :
207      );      );
208    
209      show_all_children();      show_all_children();
   
     resize(460,300);  
210  }  }
211    
212  ScriptEditor::~ScriptEditor() {  ScriptEditor::~ScriptEditor() {
# Line 496  void ScriptEditor::onButtonCancel() { Line 525  void ScriptEditor::onButtonCancel() {
525  }  }
526    
527  void ScriptEditor::onButtonApply() {  void ScriptEditor::onButtonApply() {
528        signal_script_to_be_changed.emit(m_script);
529      m_script->SetScriptAsText(m_textBuffer->get_text());      m_script->SetScriptAsText(m_textBuffer->get_text());
530        signal_script_changed.emit(m_script);
531      m_textBuffer->set_modified(false);      m_textBuffer->set_modified(false);
532  }  }
533    

Legend:
Removed from v.2899  
changed lines
  Added in v.2903

  ViewVC Help
Powered by ViewVC