[Summary] Reworked read only session dialog
authorNikolay <MPolianovskyi@wavesglobal.com>
Mon, 3 Nov 2014 14:00:40 +0000 (16:00 +0200)
committerNikolay <MPolianovskyi@wavesglobal.com>
Mon, 3 Nov 2014 14:00:40 +0000 (16:00 +0200)
[Reviewed] GZharun

gtk2_ardour/ardour_ui.cc
gtk2_ardour/read_only_session_dialog.cc [new file with mode: 0644]
gtk2_ardour/read_only_session_dialog.h [new file with mode: 0644]
gtk2_ardour/ui/read_only_session_dialog.xml [new file with mode: 0644]
gtk2_ardour/wscript

index f08aa23d402dbc5df2ba479847774b89e311c230..37797400cf3025c63a3deb045ac799e8962f00a1 100644 (file)
@@ -97,6 +97,7 @@
 typedef uint64_t microseconds_t;
 
 #include "about_dialog.h"
+#include "read_only_session_dialog.h"
 #include "actions.h"
 #include "add_tracks_dialog.h"
 #include "ambiguous_file_dialog.h"
@@ -2968,19 +2969,14 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
                }
        }
 
+    
+    
        if (!new_session->writable()) {
-               MessageDialog msg (_("This session has been opened in read-only mode.\n\nYou will not be able to record or save."),
-                                  true,
-                                  Gtk::MESSAGE_INFO,
-                                  BUTTONS_OK);
-               
-               msg.set_keep_above (true);
-               msg.set_title (_("Read-only Session"));
-               msg.set_position (Gtk::WIN_POS_CENTER);
-               pop_back_splash (msg);
-               msg.present ();
-               (void) msg.run ();
-               msg.hide ();
+        
+        ReadOnlySessionDialog ros_dialog;
+        ros_dialog.run ();
+        ros_dialog.set_keep_above (true);
+        ros_dialog.set_position (Gtk::WIN_POS_CENTER);
        }
 
        /* Now the session been created, add the transport controls */
diff --git a/gtk2_ardour/read_only_session_dialog.cc b/gtk2_ardour/read_only_session_dialog.cc
new file mode 100644 (file)
index 0000000..f1b03da
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+    Copyright (C) 2014 Waves Audio Ltd.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "pbd/file_utils.h"
+#include "ardour/filesystem_paths.h"
+
+#include "i18n.h"
+#include "about_dialog.h"
+#include "read_only_session_dialog.h"
+
+using namespace Gtk;
+using namespace Gdk;
+using namespace std;
+using namespace ARDOUR;
+using namespace PBD;
+
+ReadOnlySessionDialog::ReadOnlySessionDialog ()
+       : WavesDialog (_("read_only_session_dialog.xml"), true, false)
+    , _ok_button ( get_waves_button ("ok_button") )
+{
+       set_modal (true);
+       set_resizable (false);
+    
+    _ok_button.signal_clicked.connect (sigc::mem_fun (*this, &ReadOnlySessionDialog::ok_button_pressed));
+    
+       show_all ();
+}
+
+void
+ReadOnlySessionDialog::on_esc_pressed ()
+{
+    hide ();
+}
+
+void
+ReadOnlySessionDialog::on_enter_pressed ()
+{
+    hide ();
+}
+
+void
+ReadOnlySessionDialog::ok_button_pressed (WavesButton*)
+{
+    hide ();
+}
+
+ReadOnlySessionDialog::~ReadOnlySessionDialog ()
+{
+}
diff --git a/gtk2_ardour/read_only_session_dialog.h b/gtk2_ardour/read_only_session_dialog.h
new file mode 100644 (file)
index 0000000..77e4ba8
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+    Copyright (C) 2014 Waves Audio Ltd.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __read_only_session_dialog_h__
+#define __read_only_session_dialog_h__
+
+#include "waves_dialog.h"
+#include "ardour_button.h"
+
+class ReadOnlySessionDialog : public WavesDialog
+{
+public:
+    ReadOnlySessionDialog();
+    ~ReadOnlySessionDialog();
+    
+protected:
+    void on_esc_pressed ();
+    void on_enter_pressed ();
+    
+private:
+    void ok_button_pressed (WavesButton*);
+
+    WavesButton& _ok_button;
+};
+
+#endif /* __read_only_session_dialog_h__ */
diff --git a/gtk2_ardour/ui/read_only_session_dialog.xml b/gtk2_ardour/ui/read_only_session_dialog.xml
new file mode 100644 (file)
index 0000000..b763aaf
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Dialog title="Read-only Session" resizeable="False">
+  
+  <style name="generic_control"
+  winfont ="Arial Bold 10"
+  macfont ="Helvetica Bold 10"
+  fgnormal="#FFFFFF"
+  bgnormal="#6a6a6a"
+  fgactive="#FFFFFF"
+  bgactive="#303030"
+  fghover="#CCCCCC"
+  bghover="#898989"
+  horzalignment="start"/>
+  
+  <Layout width="350"
+          height="135"
+          style="generic_control">
+      <VBox width="350"
+            x="0"
+            y="20">
+          <Label style="generic_control"
+                 horzalignment="center"
+                 text="This session has been opened in read-only mode.\n"/>
+          
+          <Label style="generic_control"
+                 horzalignment="center"
+                 text="You will not be able to record or save."/>
+      </VBox>
+      <Button id="ok_button"
+              style="generic_control"
+              text="OK"
+              fgnormal="#6D6E72"
+              bgnormal="#CACAC5"
+              fgactive="#EDECE8"
+              bgactive="#6D6E72"
+              borderwidth="0 0 0 0"
+              bordercolor="#6D6E72"
+              width="69"
+              height="22"
+              x="255"
+              y="100"/>
+  </Layout>
+  
+</Dialog>
\ No newline at end of file
index 4335986b2792aaae5d508cb440950c2875933920..7b1f0954fe6ecbea771c6bd3f7fa0591953b5f71 100644 (file)
@@ -203,6 +203,7 @@ gtk2_ardour_sources = [
         'public_editor.cc',
         'quantize_dialog.cc',
         'rc_option_editor.cc',
+        'read_only_session_dialog.cc',
         'region_editor.cc',
         'region_gain_line.cc',
         'region_layering_order_editor.cc',