mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
compiles and runs, but crashes ... duh
git-svn-id: svn://localhost/trunk/ardour2@113 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
026f506bc6
commit
f69abbff90
44 changed files with 583 additions and 519 deletions
|
|
@ -15,6 +15,7 @@ gtkardour = env.Copy()
|
||||||
domain = 'gtk_ardour'
|
domain = 'gtk_ardour'
|
||||||
|
|
||||||
gtkardour.Append(DOMAIN=domain, MAJOR=1,MINOR=0,MICRO=2)
|
gtkardour.Append(DOMAIN=domain, MAJOR=1,MINOR=0,MICRO=2)
|
||||||
|
gtkardour.Append(CCFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
|
||||||
gtkardour.Append(CXXFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
|
gtkardour.Append(CXXFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
|
||||||
gtkardour.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
|
gtkardour.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
|
||||||
gtkardour.Append(CXXFLAGS="-DFLOWCANVAS_AA")
|
gtkardour.Append(CXXFLAGS="-DFLOWCANVAS_AA")
|
||||||
|
|
@ -44,6 +45,7 @@ gtkardour.Merge ([
|
||||||
libraries['soundtouch'],
|
libraries['soundtouch'],
|
||||||
libraries['samplerate'],
|
libraries['samplerate'],
|
||||||
libraries['jack'],
|
libraries['jack'],
|
||||||
|
libraries['glade2'],
|
||||||
libraries['libglademm']
|
libraries['libglademm']
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@
|
||||||
#include <gtkmm/accelmap.h>
|
#include <gtkmm/accelmap.h>
|
||||||
#include <gtkmm/uimanager.h>
|
#include <gtkmm/uimanager.h>
|
||||||
|
|
||||||
|
#include <pbd/error.h>
|
||||||
|
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -37,8 +39,21 @@ vector<RefPtr<Gtk::Action> > ActionManager::track_selection_sensitive_actions;
|
||||||
vector<RefPtr<Gtk::Action> > ActionManager::plugin_selection_sensitive_actions;
|
vector<RefPtr<Gtk::Action> > ActionManager::plugin_selection_sensitive_actions;
|
||||||
vector<RefPtr<Gtk::Action> > ActionManager::range_sensitive_actions;
|
vector<RefPtr<Gtk::Action> > ActionManager::range_sensitive_actions;
|
||||||
vector<RefPtr<Gtk::Action> > ActionManager::jack_sensitive_actions;
|
vector<RefPtr<Gtk::Action> > ActionManager::jack_sensitive_actions;
|
||||||
|
RefPtr<UIManager> ActionManager::ui_manager;
|
||||||
string ActionManager::unbound_string = "--";
|
string ActionManager::unbound_string = "--";
|
||||||
|
|
||||||
|
void
|
||||||
|
ActionManager::init ()
|
||||||
|
{
|
||||||
|
ui_manager = UIManager::create ();
|
||||||
|
|
||||||
|
try {
|
||||||
|
ui_manager->add_ui_from_file ("ardour-menus.xml");
|
||||||
|
} catch (Glib::MarkupError& err) {
|
||||||
|
error << "badly formatted UI definition file" << endmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
RefPtr<Action>
|
RefPtr<Action>
|
||||||
ActionManager::register_action (RefPtr<ActionGroup> group, string name, string label, slot<void> sl, guint key, Gdk::ModifierType mods)
|
ActionManager::register_action (RefPtr<ActionGroup> group, string name, string label, slot<void> sl, guint key, Gdk::ModifierType mods)
|
||||||
|
|
@ -129,7 +144,7 @@ ActionManager::lookup_entry (const ustring accel_path, Gtk::AccelKey& key)
|
||||||
void
|
void
|
||||||
ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& keys, vector<AccelKey>& bindings)
|
ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& keys, vector<AccelKey>& bindings)
|
||||||
{
|
{
|
||||||
ListHandle<RefPtr<ActionGroup> > uim_groups = ui_manager.get_action_groups ();
|
ListHandle<RefPtr<ActionGroup> > uim_groups = ui_manager->get_action_groups ();
|
||||||
|
|
||||||
for (ListHandle<RefPtr<ActionGroup> >::iterator g = uim_groups.begin(); g != uim_groups.end(); ++g) {
|
for (ListHandle<RefPtr<ActionGroup> >::iterator g = uim_groups.begin(); g != uim_groups.end(); ++g) {
|
||||||
|
|
||||||
|
|
@ -148,7 +163,7 @@ ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, ve
|
||||||
bool known = lookup_entry (accel_path, key);
|
bool known = lookup_entry (accel_path, key);
|
||||||
|
|
||||||
if (known) {
|
if (known) {
|
||||||
keys.push_back (ui_manager.get_accel_group()->name (key.get_key(), Gdk::ModifierType (key.get_mod())));
|
keys.push_back (ui_manager->get_accel_group()->name (key.get_key(), Gdk::ModifierType (key.get_mod())));
|
||||||
} else {
|
} else {
|
||||||
keys.push_back (unbound_string);
|
keys.push_back (unbound_string);
|
||||||
}
|
}
|
||||||
|
|
@ -161,17 +176,17 @@ ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, ve
|
||||||
void
|
void
|
||||||
ActionManager::add_action_group (RefPtr<ActionGroup> grp)
|
ActionManager::add_action_group (RefPtr<ActionGroup> grp)
|
||||||
{
|
{
|
||||||
ui_manager.insert_action_group (grp);
|
ui_manager->insert_action_group (grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget*
|
Widget*
|
||||||
ActionManager::get_widget (ustring name)
|
ActionManager::get_widget (ustring name)
|
||||||
{
|
{
|
||||||
return ui_manager.get_widget (name);
|
return ui_manager->get_widget (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Action>
|
RefPtr<Action>
|
||||||
ActionManager::get_action (ustring name)
|
ActionManager::get_action (ustring name)
|
||||||
{
|
{
|
||||||
return ui_manager.get_action (name);
|
return ui_manager->get_action (name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ class ActionManager
|
||||||
ActionManager() {}
|
ActionManager() {}
|
||||||
virtual ~ActionManager () {}
|
virtual ~ActionManager () {}
|
||||||
|
|
||||||
|
static void init ();
|
||||||
|
|
||||||
static std::vector<Glib::RefPtr<Gtk::Action> > session_sensitive_actions;
|
static std::vector<Glib::RefPtr<Gtk::Action> > session_sensitive_actions;
|
||||||
static std::vector<Glib::RefPtr<Gtk::Action> > region_list_selection_sensitive_actions;
|
static std::vector<Glib::RefPtr<Gtk::Action> > region_list_selection_sensitive_actions;
|
||||||
static std::vector<Glib::RefPtr<Gtk::Action> > region_selection_sensitive_actions;
|
static std::vector<Glib::RefPtr<Gtk::Action> > region_selection_sensitive_actions;
|
||||||
|
|
@ -27,7 +29,7 @@ class ActionManager
|
||||||
static std::vector<Glib::RefPtr<Gtk::Action> > jack_sensitive_actions;
|
static std::vector<Glib::RefPtr<Gtk::Action> > jack_sensitive_actions;
|
||||||
|
|
||||||
static std::string unbound_string; /* the key string returned if an action is not bound */
|
static std::string unbound_string; /* the key string returned if an action is not bound */
|
||||||
static Gtk::UIManager ui_manager;
|
static Glib::RefPtr<Gtk::UIManager> ui_manager;
|
||||||
|
|
||||||
static Gtk::Widget* get_widget (Glib::ustring name);
|
static Gtk::Widget* get_widget (Glib::ustring name);
|
||||||
static Glib::RefPtr<Gtk::Action> get_action (Glib::ustring name);
|
static Glib::RefPtr<Gtk::Action> get_action (Glib::ustring name);
|
||||||
|
|
|
||||||
|
|
@ -1,86 +1,5 @@
|
||||||
<ui>
|
<ui>
|
||||||
|
|
||||||
<popup name='ShuttleUnitsMenu'>
|
|
||||||
<menuitem action='SetShuttleUnitsSemitones'/>
|
|
||||||
<menuitem action='SetShuttleUnitsPercentage'/>
|
|
||||||
</popup>
|
|
||||||
|
|
||||||
<popup name='ShuttleStyleMenu'>
|
|
||||||
<menuitem action='SetShuttleActionSprung'/>
|
|
||||||
<menuitem action='SetShuttleActionWheel'/>
|
|
||||||
</popup>
|
|
||||||
|
|
||||||
<popup name='RegionListMenu'>
|
|
||||||
<menuitem action='rlAudition'/>
|
|
||||||
<menuitem action='rlHide'/>
|
|
||||||
<menuitem action='rlRemove'/>
|
|
||||||
<separator/>
|
|
||||||
<menuitem action='rlShowAll'/>
|
|
||||||
<separator/>
|
|
||||||
<menu name='Sorting'>
|
|
||||||
<menuitem action='SortAscending'/>
|
|
||||||
<menuitem action='SortDescending'/>
|
|
||||||
<separator/>
|
|
||||||
<menuitem action='SortByRegionName'/>
|
|
||||||
<menuitem action='SortByRegionLength'/>
|
|
||||||
<menuitem action='SortByRegionPosition'/>
|
|
||||||
<menuitem action='SortByRegionTimestamp'/>
|
|
||||||
<menuitem action='SortByRegionStartinFile'/>
|
|
||||||
<menuitem action='SortByRegionEndinFile'/>
|
|
||||||
<menuitem action='SortBySourceFileName'/>
|
|
||||||
<menuitem action='SortBySourceFileLength'/>
|
|
||||||
<menuitem action='SortBySourceFileCreationDate'/>
|
|
||||||
<menuitem action='SortBySourceFilesystem'/>
|
|
||||||
</menu>
|
|
||||||
<menuitem action='rlImportAudio'/>
|
|
||||||
<menuitem action='rlEmbedAudio'/>
|
|
||||||
</popup>
|
|
||||||
|
|
||||||
<menubar name='Main'>
|
<menubar name='Main'>
|
||||||
<menu action='Session'>
|
|
||||||
<menuitem action='New'/>
|
|
||||||
<menuitem action='Open'/>
|
|
||||||
<menuitem action='Recent'/>
|
|
||||||
<menuitem action='Close'/>
|
|
||||||
<separator/>
|
|
||||||
<menuitem action='AddTrackBus'/>
|
|
||||||
<separator/>
|
|
||||||
<menu action='Export'>
|
|
||||||
<menuitem action='ExportSession'/>
|
|
||||||
<menuitem action='ExportRange'/>
|
|
||||||
</menu>
|
|
||||||
<separator/>
|
|
||||||
<menu name='Cleanup'>
|
|
||||||
<menuitem action='CleanupUnused'/>
|
|
||||||
<menuitem action='FlushWastebasket'/>
|
|
||||||
</menu>
|
|
||||||
<separator/>
|
|
||||||
<menu action='Quit'>
|
|
||||||
</menu>
|
|
||||||
<menu name='JACK'>
|
|
||||||
<menuitem action='Disconnect'/>
|
|
||||||
<menuitem action='Connect'/>
|
|
||||||
<menu name='Latency'>
|
|
||||||
<menuitem action='JACKLatency32'/>
|
|
||||||
<menuitem action='JACKLatency64'/>
|
|
||||||
<menuitem action='JACKLatency128'/>
|
|
||||||
<menuitem action='JACKLatency256'/>
|
|
||||||
<menuitem action='JACKLatency512'/>
|
|
||||||
<menuitem action='JACKLatency1024'/>
|
|
||||||
<menuitem action='JACKLatency2048'/>
|
|
||||||
<menuitem action='JACKLatency4096'/>
|
|
||||||
<menuitem action='JACKLatency8192'/>
|
|
||||||
</menu>
|
|
||||||
</menu>
|
|
||||||
<menu name='Windows'>
|
|
||||||
<menuitem action='GotoEditor'/>
|
|
||||||
<menuitem action='GotoMixer'/>
|
|
||||||
<menuitem action='ToggleOptionsEditor'/>
|
|
||||||
<menuitem action='ToggleAudioLibrary'/>
|
|
||||||
<menuitem action='ToggleConnections'/>
|
|
||||||
<menuitem action='ToggleLocations'/>
|
|
||||||
<menuitem action='ToggleBigClock'/>
|
|
||||||
<menuitem action='ToggleAbout'/>
|
|
||||||
</menu>
|
|
||||||
</menubar>
|
</menubar>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gdkmm/window.h>
|
#include <gtkmm2ext/utils.h>
|
||||||
|
|
||||||
#include "ardour_message.h"
|
#include "ardour_message.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
@ -54,8 +54,7 @@ ArdourMessage::ArdourMessage (Gtk::Window* parent,
|
||||||
add (packer);
|
add (packer);
|
||||||
show_all ();
|
show_all ();
|
||||||
|
|
||||||
realize();
|
signal_realize().connect (bind (sigc::ptr_fun (Gtkmm2ext::set_decoration), this, Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH)));
|
||||||
get_window()->set_decorations (Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
|
|
||||||
|
|
||||||
if (grab_focus) {
|
if (grab_focus) {
|
||||||
ok_button.grab_focus ();
|
ok_button.grab_focus ();
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@
|
||||||
#include <ardour/port.h>
|
#include <ardour/port.h>
|
||||||
#include <ardour/audio_track.h>
|
#include <ardour/audio_track.h>
|
||||||
|
|
||||||
|
#include "actions.h"
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
#include "ardour_message.h"
|
#include "ardour_message.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
|
|
@ -830,11 +831,12 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
|
||||||
if (theArdourUI == 0) {
|
if (theArdourUI == 0) {
|
||||||
theArdourUI = this;
|
theArdourUI = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActionManager::init ();
|
||||||
|
|
||||||
m_new_session_dialog = 0;
|
m_new_session_dialog = 0;
|
||||||
m_new_session_dialog_ref = NewSessionDialogFactory::create();
|
m_new_session_dialog_ref = NewSessionDialogFactory::create();
|
||||||
m_new_session_dialog_ref->get_widget_derived(NewSessionDialogFactory::top_level_widget_name(),
|
m_new_session_dialog_ref->get_widget_derived (NewSessionDialogFactory::top_level_widget_name(), m_new_session_dialog);
|
||||||
m_new_session_dialog);
|
|
||||||
editor = 0;
|
editor = 0;
|
||||||
mixer = 0;
|
mixer = 0;
|
||||||
session = 0;
|
session = 0;
|
||||||
|
|
@ -859,8 +861,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
|
||||||
last_configure_time.tv_sec = 0;
|
last_configure_time.tv_sec = 0;
|
||||||
last_configure_time.tv_usec = 0;
|
last_configure_time.tv_usec = 0;
|
||||||
|
|
||||||
ui_manager = UIManager::create ();
|
|
||||||
|
|
||||||
shuttle_grabbed = false;
|
shuttle_grabbed = false;
|
||||||
shuttle_fract = 0.0;
|
shuttle_fract = 0.0;
|
||||||
|
|
||||||
|
|
@ -874,10 +874,10 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
|
||||||
shuttle_actions->add (Action::create (X_("SetShuttleActionSprung"), _("Sprung")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Sprung));
|
shuttle_actions->add (Action::create (X_("SetShuttleActionSprung"), _("Sprung")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Sprung));
|
||||||
shuttle_actions->add (Action::create (X_("SetShuttleActionWheel"), _("Wheel")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Wheel));
|
shuttle_actions->add (Action::create (X_("SetShuttleActionWheel"), _("Wheel")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Wheel));
|
||||||
|
|
||||||
ui_manager->insert_action_group (shuttle_actions);
|
ActionManager::add_action_group (shuttle_actions);
|
||||||
|
|
||||||
shuttle_style_menu = dynamic_cast<Menu*> (ui_manager->get_widget ("ShuttleStylePopup"));
|
shuttle_style_menu = dynamic_cast<Menu*> (ActionManager::get_widget ("ShuttleStylePopup"));
|
||||||
shuttle_unit_menu = dynamic_cast<Menu*> (ui_manager->get_widget ("ShuttleUnitPopup"));
|
shuttle_unit_menu = dynamic_cast<Menu*> (ActionManager::get_widget ("ShuttleUnitPopup"));
|
||||||
|
|
||||||
gettimeofday (&last_peak_grab, 0);
|
gettimeofday (&last_peak_grab, 0);
|
||||||
gettimeofday (&last_shuttle_request, 0);
|
gettimeofday (&last_shuttle_request, 0);
|
||||||
|
|
@ -934,7 +934,8 @@ ARDOUR_UI::set_engine (AudioEngine& e)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GTK_ARDOUR::show_key_actions) {
|
if (GTK_ARDOUR::show_key_actions) {
|
||||||
KeyboardTarget::show_all_actions ();
|
// GTK2FIX
|
||||||
|
// show_all_actions ();
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -727,7 +727,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
|
||||||
int make_session_clean ();
|
int make_session_clean ();
|
||||||
bool filter_ardour_session_dirs (const Gtk::FileFilter::Info&);
|
bool filter_ardour_session_dirs (const Gtk::FileFilter::Info&);
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::UIManager> ui_manager;
|
|
||||||
Glib::RefPtr<Gtk::ActionGroup> common_actions;
|
Glib::RefPtr<Gtk::ActionGroup> common_actions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -247,12 +247,13 @@ int
|
||||||
ARDOUR_UI::create_connection_editor ()
|
ARDOUR_UI::create_connection_editor ()
|
||||||
{
|
{
|
||||||
if (connection_editor == 0) {
|
if (connection_editor == 0) {
|
||||||
connection_editor = new ConnectionEditor ();
|
// GTK2FIX
|
||||||
connection_editor->signal_unmap().connect (mem_fun(*this, &ARDOUR_UI::connection_editor_hiding));
|
// connection_editor = new ConnectionEditor ();
|
||||||
|
// connection_editor->signal_unmap().connect (mem_fun(*this, &ARDOUR_UI::connection_editor_hiding));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
connection_editor->set_session (session);
|
// connection_editor->set_session (session);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -265,6 +266,9 @@ ARDOUR_UI::toggle_connection_editor ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//GTK2FIX
|
||||||
|
#if 0
|
||||||
|
|
||||||
if (connection_editor->within_hiding()) {
|
if (connection_editor->within_hiding()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -275,12 +279,14 @@ ARDOUR_UI::toggle_connection_editor ()
|
||||||
} else {
|
} else {
|
||||||
connection_editor->hide_all();
|
connection_editor->hide_all();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR_UI::connection_editor_hiding()
|
ARDOUR_UI::connection_editor_hiding()
|
||||||
{
|
{
|
||||||
connection_editor_check->set_active(false);
|
//GTK2FIX
|
||||||
|
// connection_editor_check->set_active(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ ARDOUR_UI::install_actions ()
|
||||||
void
|
void
|
||||||
ARDOUR_UI::build_menu_bar ()
|
ARDOUR_UI::build_menu_bar ()
|
||||||
{
|
{
|
||||||
menu_bar = dynamic_cast<MenuBar*> (ui_manager->get_widget (X_("/Main")));
|
menu_bar = dynamic_cast<MenuBar*> (ActionManager::get_widget (X_("/Main")));
|
||||||
menu_bar->set_name ("MainMenuBar");
|
menu_bar->set_name ("MainMenuBar");
|
||||||
|
|
||||||
wall_clock_box.add (wall_clock_label);
|
wall_clock_box.add (wall_clock_label);
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@
|
||||||
|
|
||||||
#include <pbd/error.h>
|
#include <pbd/error.h>
|
||||||
|
|
||||||
|
#include <gtkmm/image.h>
|
||||||
|
#include <gdkmm/color.h>
|
||||||
|
#include <gdkmm/bitmap.h>
|
||||||
|
|
||||||
#include <gtkmm2ext/gtk_ui.h>
|
#include <gtkmm2ext/gtk_ui.h>
|
||||||
#include <gtkmm2ext/tearoff.h>
|
#include <gtkmm2ext/tearoff.h>
|
||||||
#include <gtkmm2ext/utils.h>
|
#include <gtkmm2ext/utils.h>
|
||||||
|
|
@ -40,16 +44,12 @@
|
||||||
#include <ardour/location.h>
|
#include <ardour/location.h>
|
||||||
#include <ardour/audioplaylist.h>
|
#include <ardour/audioplaylist.h>
|
||||||
#include <ardour/audioregion.h>
|
#include <ardour/audioregion.h>
|
||||||
#include <ardour/session.h>
|
#include <ardour/region.h>
|
||||||
#include <ardour/session_route.h>
|
#include <ardour/session_route.h>
|
||||||
#include <ardour/tempo.h>
|
#include <ardour/tempo.h>
|
||||||
#include <ardour/utils.h>
|
#include <ardour/utils.h>
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
#include "canvas-ruler.h"
|
|
||||||
#include "canvas-simpleline.h"
|
|
||||||
#include "canvas-simplerect.h"
|
|
||||||
#include "canvas-waveview.h"
|
|
||||||
#include "check_mark.h"
|
#include "check_mark.h"
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
#include "grouped_buttons.h"
|
#include "grouped_buttons.h"
|
||||||
|
|
@ -60,6 +60,7 @@
|
||||||
#include "rgb_macros.h"
|
#include "rgb_macros.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "streamview.h"
|
#include "streamview.h"
|
||||||
|
#include "simpleline.h"
|
||||||
#include "time_axis_view.h"
|
#include "time_axis_view.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "crossfade_view.h"
|
#include "crossfade_view.h"
|
||||||
|
|
@ -67,6 +68,7 @@
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "crossfade_edit.h"
|
#include "crossfade_edit.h"
|
||||||
#include "audio_time_axis.h"
|
#include "audio_time_axis.h"
|
||||||
|
#include "canvas_impl.h"
|
||||||
#include "gui_thread.h"
|
#include "gui_thread.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
@ -366,9 +368,6 @@ Editor::Editor (AudioEngine& eng)
|
||||||
build_cursors ();
|
build_cursors ();
|
||||||
setup_toolbar ();
|
setup_toolbar ();
|
||||||
|
|
||||||
XMLNode* node = ARDOUR_UI::instance()->editor_settings();
|
|
||||||
set_state (*node);
|
|
||||||
|
|
||||||
edit_cursor_clock.ValueChanged.connect (mem_fun(*this, &Editor::edit_cursor_clock_changed));
|
edit_cursor_clock.ValueChanged.connect (mem_fun(*this, &Editor::edit_cursor_clock_changed));
|
||||||
|
|
||||||
time_canvas_vbox.pack_start (*minsec_ruler, false, false);
|
time_canvas_vbox.pack_start (*minsec_ruler, false, false);
|
||||||
|
|
@ -470,9 +469,9 @@ Editor::Editor (AudioEngine& eng)
|
||||||
// ARDOUR_UI::instance()->tooltips().set_tip (zoom_onetoone_button, _("Zoom in 1:1"));
|
// ARDOUR_UI::instance()->tooltips().set_tip (zoom_onetoone_button, _("Zoom in 1:1"));
|
||||||
ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to session"));
|
ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to session"));
|
||||||
|
|
||||||
zoom_in_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(zoom_in_button_xpm)))));
|
zoom_in_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_in_button_xpm)))));
|
||||||
zoom_out_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(zoom_out_button_xpm)))));
|
zoom_out_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_out_button_xpm)))));
|
||||||
zoom_out_full_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(zoom_out_full_button_xpm)))));
|
zoom_out_full_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_out_full_button_xpm)))));
|
||||||
// zoom_onetoone_button.add (*(manage (new Gtk::Image (zoom_onetoone_button_xpm))));
|
// zoom_onetoone_button.add (*(manage (new Gtk::Image (zoom_onetoone_button_xpm))));
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -620,8 +619,6 @@ Editor::Editor (AudioEngine& eng)
|
||||||
region_list_display.signal_key_release_event().connect (mem_fun(*this, &Editor::region_list_display_key_release));
|
region_list_display.signal_key_release_event().connect (mem_fun(*this, &Editor::region_list_display_key_release));
|
||||||
region_list_display.signal_button_press_event().connect (mem_fun(*this, &Editor::region_list_display_button_press));
|
region_list_display.signal_button_press_event().connect (mem_fun(*this, &Editor::region_list_display_button_press));
|
||||||
region_list_display.signal_button_release_event().connect (mem_fun(*this, &Editor::region_list_display_button_release));
|
region_list_display.signal_button_release_event().connect (mem_fun(*this, &Editor::region_list_display_button_release));
|
||||||
region_list_display.signal_enter_notify_event().connect (mem_fun(*this, &Editor::region_list_display_enter_notify));
|
|
||||||
region_list_display.signal_leave_notify_event().connect (mem_fun(*this, &Editor::region_list_display_leave_notify));
|
|
||||||
region_list_display.get_selection()->signal_changed().connect (mem_fun(*this, &Editor::region_list_selection_changed));
|
region_list_display.get_selection()->signal_changed().connect (mem_fun(*this, &Editor::region_list_selection_changed));
|
||||||
// GTK2FIX
|
// GTK2FIX
|
||||||
//region_list_display.unselect_row.connect (mem_fun(*this, &Editor::region_list_display_unselected));
|
//region_list_display.unselect_row.connect (mem_fun(*this, &Editor::region_list_display_unselected));
|
||||||
|
|
@ -688,6 +685,9 @@ Editor::Editor (AudioEngine& eng)
|
||||||
|
|
||||||
vpacker.pack_end (global_hpacker, true, true);
|
vpacker.pack_end (global_hpacker, true, true);
|
||||||
|
|
||||||
|
XMLNode* node = ARDOUR_UI::instance()->editor_settings();
|
||||||
|
set_state (*node);
|
||||||
|
|
||||||
_playlist_selector = new PlaylistSelector();
|
_playlist_selector = new PlaylistSelector();
|
||||||
_playlist_selector->signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), static_cast<Window *> (_playlist_selector)));
|
_playlist_selector->signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), static_cast<Window *> (_playlist_selector)));
|
||||||
|
|
||||||
|
|
@ -695,8 +695,8 @@ Editor::Editor (AudioEngine& eng)
|
||||||
|
|
||||||
/* nudge stuff */
|
/* nudge stuff */
|
||||||
|
|
||||||
nudge_forward_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(right_arrow_xpm)))));
|
nudge_forward_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(right_arrow_xpm)))));
|
||||||
nudge_backward_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(left_arrow_xpm)))));
|
nudge_backward_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(left_arrow_xpm)))));
|
||||||
|
|
||||||
ARDOUR_UI::instance()->tooltips().set_tip (nudge_forward_button, _("Nudge region/selection forwards"));
|
ARDOUR_UI::instance()->tooltips().set_tip (nudge_forward_button, _("Nudge region/selection forwards"));
|
||||||
ARDOUR_UI::instance()->tooltips().set_tip (nudge_backward_button, _("Nudge region/selection backwards"));
|
ARDOUR_UI::instance()->tooltips().set_tip (nudge_backward_button, _("Nudge region/selection backwards"));
|
||||||
|
|
@ -878,13 +878,13 @@ Editor::initialize_canvas ()
|
||||||
transport_bar_drag_rect->set_property ("outline_pixels", 0);
|
transport_bar_drag_rect->set_property ("outline_pixels", 0);
|
||||||
transport_bar_drag_rect->hide ();
|
transport_bar_drag_rect->hide ();
|
||||||
|
|
||||||
marker_drag_line_points->push_back(Gnome::Art::Point(0.0, 0.0));
|
marker_drag_line_points.push_back(Gnome::Art::Point(0.0, 0.0));
|
||||||
marker_drag_line_points->push_back(Gnome::Art::Point(0.0, 0.0));
|
marker_drag_line_points.push_back(Gnome::Art::Point(0.0, 0.0));
|
||||||
|
|
||||||
marker_drag_line = new ArdourCanvas::Line (*track_canvas.root());
|
marker_drag_line = new ArdourCanvas::Line (*track_canvas.root());
|
||||||
marker_drag_line->set_property ("width_pixels", 1);
|
marker_drag_line->set_property ("width_pixels", 1);
|
||||||
marker_drag_line->set_property("fill_color_rgba", color_map[cMarkerDragLine]);
|
marker_drag_line->set_property("fill_color_rgba", color_map[cMarkerDragLine]);
|
||||||
marker_drag_line->set_property("points", marker_drag_line_points->gobj());
|
marker_drag_line->set_property("points", marker_drag_line_points);
|
||||||
marker_drag_line->hide();
|
marker_drag_line->hide();
|
||||||
|
|
||||||
range_marker_drag_rect = new ArdourCanvas::SimpleRect (*track_canvas.root(), 0.0, 0.0, 0.0, 0.0);
|
range_marker_drag_rect = new ArdourCanvas::SimpleRect (*track_canvas.root(), 0.0, 0.0, 0.0, 0.0);
|
||||||
|
|
@ -906,7 +906,7 @@ Editor::initialize_canvas ()
|
||||||
|
|
||||||
transport_loop_range_rect->lower_to_bottom (); // loop on the bottom
|
transport_loop_range_rect->lower_to_bottom (); // loop on the bottom
|
||||||
|
|
||||||
transport_punchin_line = new ArdourCanvas::Line (*time_line_group);
|
transport_punchin_line = new ArdourCanvas::SimpleLine (*time_line_group);
|
||||||
transport_punchin_line->set_property ("x1", 0.0);
|
transport_punchin_line->set_property ("x1", 0.0);
|
||||||
transport_punchin_line->set_property ("y1", 0.0);
|
transport_punchin_line->set_property ("y1", 0.0);
|
||||||
transport_punchin_line->set_property ("x2", 0.0);
|
transport_punchin_line->set_property ("x2", 0.0);
|
||||||
|
|
@ -916,7 +916,7 @@ Editor::initialize_canvas ()
|
||||||
transport_punchin_line->set_property ("outline_pixels", 1);
|
transport_punchin_line->set_property ("outline_pixels", 1);
|
||||||
transport_punchin_line->hide ();
|
transport_punchin_line->hide ();
|
||||||
|
|
||||||
transport_punchout_line = new ArdourCanvas::Line (*time_line_group);
|
transport_punchout_line = new ArdourCanvas::SimpleLine (*time_line_group);
|
||||||
transport_punchout_line->set_property ("x1", 0.0);
|
transport_punchout_line->set_property ("x1", 0.0);
|
||||||
transport_punchout_line->set_property ("y1", 0.0);
|
transport_punchout_line->set_property ("y1", 0.0);
|
||||||
transport_punchout_line->set_property ("x2", 0.0);
|
transport_punchout_line->set_property ("x2", 0.0);
|
||||||
|
|
@ -1188,19 +1188,19 @@ Editor::deferred_reposition_and_zoom (jack_nframes_t frame, double nfpu)
|
||||||
void
|
void
|
||||||
Editor::on_realize ()
|
Editor::on_realize ()
|
||||||
{
|
{
|
||||||
|
Window::on_realize ();
|
||||||
|
|
||||||
/* Even though we're not using acceleration, we want the
|
/* Even though we're not using acceleration, we want the
|
||||||
labels to show up.
|
labels to show up.
|
||||||
*/
|
*/
|
||||||
Glib::RefPtr<Gdk::Pixmap> empty_pixmap = Gdk::Pixmap::create(get_window(), 1, 1, 1);
|
|
||||||
Glib::RefPtr<Gdk::Pixmap> empty_bitmap = Gdk::Pixmap::create(get_window(), 1, 1, 1);
|
|
||||||
|
|
||||||
|
|
||||||
track_context_menu.accelerate (*this->get_toplevel());
|
track_context_menu.accelerate (*this->get_toplevel());
|
||||||
track_region_context_menu.accelerate (*this->get_toplevel());
|
track_region_context_menu.accelerate (*this->get_toplevel());
|
||||||
|
|
||||||
Window::on_realize ();
|
Glib::RefPtr<Gdk::Pixmap> empty_pixmap = Gdk::Pixmap::create(get_window(), 1, 1, 1);
|
||||||
|
Glib::RefPtr<Gdk::Pixmap> empty_bitmap = Gdk::Pixmap::create(get_window(), 1, 1, 1);
|
||||||
Gdk::Color white ("#ffffff" );
|
Gdk::Color white ("#ffffff" );
|
||||||
|
|
||||||
null_cursor = new Gdk::Cursor(empty_pixmap, empty_bitmap, white, white, 0, 0);
|
null_cursor = new Gdk::Cursor(empty_pixmap, empty_bitmap, white, white, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1339,8 +1339,8 @@ Editor::reset_scrolling_region (Gtk::Allocation* alloc)
|
||||||
if (playhead_cursor) playhead_cursor->set_length (canvas_alloc_height);
|
if (playhead_cursor) playhead_cursor->set_length (canvas_alloc_height);
|
||||||
|
|
||||||
if (marker_drag_line) {
|
if (marker_drag_line) {
|
||||||
marker_drag_line_points->back().set_x(canvas_height);
|
marker_drag_line_points.back().set_x(canvas_height);
|
||||||
// cerr << "set mlA points, nc = " << marker_drag_line_points->num_points << endl;
|
// cerr << "set mlA points, nc = " << marker_drag_line_points.num_points << endl;
|
||||||
marker_drag_line->set_property("points", marker_drag_line_points);
|
marker_drag_line->set_property("points", marker_drag_line_points);
|
||||||
}
|
}
|
||||||
if (range_marker_drag_rect) {
|
if (range_marker_drag_rect) {
|
||||||
|
|
@ -1711,28 +1711,25 @@ Editor::connect_to_session (Session *t)
|
||||||
void
|
void
|
||||||
Editor::build_cursors ()
|
Editor::build_cursors ()
|
||||||
{
|
{
|
||||||
|
using namespace Gdk;
|
||||||
|
|
||||||
Gdk::Color fg ("#ff0000"); /* Red. */
|
Gdk::Color fg ("#ff0000"); /* Red. */
|
||||||
Gdk::Color bg ("#0000ff"); /* Blue. */
|
Gdk::Color bg ("#0000ff"); /* Blue. */
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::RefPtr <Gdk::Pixmap> source, mask;
|
RefPtr<Bitmap> source, mask;
|
||||||
source = Gdk::Pixmap::create_from_data (source, hand_bits,
|
source = Bitmap::create (hand_bits, hand_width, hand_height);
|
||||||
hand_width, hand_height, 1, fg, bg);
|
mask = Bitmap::create (handmask_bits, handmask_width, handmask_height);
|
||||||
Gdk::Pixmap::create_from_data(mask, handmask_bits,
|
|
||||||
handmask_width, handmask_height, 1, fg, bg);
|
|
||||||
grabber_cursor = new Gdk::Cursor (source, mask, fg, bg, hand_x_hot, hand_y_hot);
|
grabber_cursor = new Gdk::Cursor (source, mask, fg, bg, hand_x_hot, hand_y_hot);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gdk::Color mbg ("#000000" ); /* Black */
|
Gdk::Color mbg ("#000000" ); /* Black */
|
||||||
Gdk::Color mfg ("#0000ff" ); /* Blue. */
|
Gdk::Color mfg ("#0000ff" ); /* Blue. */
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::RefPtr <Gdk::Pixmap> source, mask;
|
RefPtr<Bitmap> source, mask;
|
||||||
|
source = Bitmap::create (mag_bits, mag_width, mag_height);
|
||||||
Gdk::Pixmap::create_from_data (source, mag_bits,
|
mask = Bitmap::create (magmask_bits, mag_width, mag_height);
|
||||||
mag_width, mag_height, 1, fg, bg);
|
|
||||||
Gdk::Pixmap::create_from_data (mask, magmask_bits,
|
|
||||||
mag_width, mag_height, 1, fg, bg);
|
|
||||||
zoom_cursor = new Gdk::Cursor (source, mask, mfg, mbg, mag_x_hot, mag_y_hot);
|
zoom_cursor = new Gdk::Cursor (source, mask, mfg, mbg, mag_x_hot, mag_y_hot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1740,21 +1737,17 @@ Editor::build_cursors ()
|
||||||
Gdk::Color ffg ("#000000" );
|
Gdk::Color ffg ("#000000" );
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::RefPtr <Gdk::Pixmap> source, mask;
|
RefPtr<Bitmap> source, mask;
|
||||||
|
|
||||||
Gdk::Pixmap::create_from_data (source, fader_cursor_bits,
|
source = Bitmap::create (fader_cursor_bits, fader_cursor_width, fader_cursor_height);
|
||||||
fader_cursor_width, fader_cursor_height, 1, fg, bg);
|
mask = Bitmap::create (fader_cursor_mask_bits, fader_cursor_width, fader_cursor_height);
|
||||||
Gdk::Pixmap::create_from_data (mask, fader_cursor_mask_bits,
|
|
||||||
fader_cursor_width, fader_cursor_height, 1, fg, bg);
|
|
||||||
fader_cursor = new Gdk::Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot);
|
fader_cursor = new Gdk::Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::RefPtr <Gdk::Pixmap> source, mask;
|
RefPtr<Bitmap> source, mask;
|
||||||
Gdk::Pixmap::create_from_data (source,speaker_cursor_bits,
|
source = Bitmap::create (speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
|
||||||
speaker_cursor_width, speaker_cursor_height, 1, fg, bg);
|
mask = Bitmap::create (speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
|
||||||
Gdk::Pixmap::create_from_data (mask, speaker_cursor_mask_bits,
|
|
||||||
speaker_cursor_width, speaker_cursor_height, 1, fg, bg);
|
|
||||||
speaker_cursor = new Gdk::Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
|
speaker_cursor = new Gdk::Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4399,9 +4392,11 @@ Editor::playlist_deletion_dialog (Playlist* pl)
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* keep the playlist */
|
break;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* keep the playlist */
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -545,15 +545,15 @@ class Editor : public PublicEditor
|
||||||
void store_ruler_visibility ();
|
void store_ruler_visibility ();
|
||||||
void restore_ruler_visibility ();
|
void restore_ruler_visibility ();
|
||||||
|
|
||||||
static gint _metric_get_smpte (GtkCustomRulerMark **, gulong, gulong, gint);
|
static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
|
||||||
static gint _metric_get_bbt (GtkCustomRulerMark **, gulong, gulong, gint);
|
static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
|
||||||
static gint _metric_get_frames (GtkCustomRulerMark **, gulong, gulong, gint);
|
static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
|
||||||
static gint _metric_get_minsec (GtkCustomRulerMark **, gulong, gulong, gint);
|
static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
|
||||||
|
|
||||||
gint metric_get_smpte (GtkCustomRulerMark **, gulong, gulong, gint);
|
gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
|
||||||
gint metric_get_bbt (GtkCustomRulerMark **, gulong, gulong, gint);
|
gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
|
||||||
gint metric_get_frames (GtkCustomRulerMark **, gulong, gulong, gint);
|
gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
|
||||||
gint metric_get_minsec (GtkCustomRulerMark **, gulong, gulong, gint);
|
gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
|
||||||
|
|
||||||
GtkWidget *_smpte_ruler;
|
GtkWidget *_smpte_ruler;
|
||||||
GtkWidget *_bbt_ruler;
|
GtkWidget *_bbt_ruler;
|
||||||
|
|
@ -734,8 +734,6 @@ class Editor : public PublicEditor
|
||||||
bool region_list_display_key_release (GdkEventKey *);
|
bool region_list_display_key_release (GdkEventKey *);
|
||||||
bool region_list_display_button_press (GdkEventButton *);
|
bool region_list_display_button_press (GdkEventButton *);
|
||||||
bool region_list_display_button_release (GdkEventButton *);
|
bool region_list_display_button_release (GdkEventButton *);
|
||||||
bool region_list_display_enter_notify (GdkEventCrossing *);
|
|
||||||
bool region_list_display_leave_notify (GdkEventCrossing *);
|
|
||||||
void region_list_clear ();
|
void region_list_clear ();
|
||||||
void region_list_selection_mapover (sigc::slot<void,ARDOUR::Region&>);
|
void region_list_selection_mapover (sigc::slot<void,ARDOUR::Region&>);
|
||||||
void build_region_list_menu ();
|
void build_region_list_menu ();
|
||||||
|
|
@ -1425,21 +1423,21 @@ class Editor : public PublicEditor
|
||||||
void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
|
void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
|
||||||
void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
|
void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
|
||||||
|
|
||||||
ArdourCanvas::SimpleRect* range_bar_drag_rect;
|
ArdourCanvas::SimpleRect* range_bar_drag_rect;
|
||||||
ArdourCanvas::SimpleRect* transport_bar_drag_rect;
|
ArdourCanvas::SimpleRect* transport_bar_drag_rect;
|
||||||
ArdourCanvas::Line* marker_drag_line;
|
ArdourCanvas::Line* marker_drag_line;
|
||||||
ArdourCanvas::Points* marker_drag_line_points;
|
ArdourCanvas::Points marker_drag_line_points;
|
||||||
ArdourCanvas::SimpleRect* range_marker_drag_rect;
|
ArdourCanvas::SimpleRect* range_marker_drag_rect;
|
||||||
|
|
||||||
void update_marker_drag_item (ARDOUR::Location *);
|
void update_marker_drag_item (ARDOUR::Location *);
|
||||||
|
|
||||||
ArdourCanvas::SimpleRect *transport_bar_range_rect;
|
ArdourCanvas::SimpleRect *transport_bar_range_rect;
|
||||||
ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
|
ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
|
||||||
ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
|
ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
|
||||||
ArdourCanvas::SimpleRect *transport_loop_range_rect;
|
ArdourCanvas::SimpleRect *transport_loop_range_rect;
|
||||||
ArdourCanvas::SimpleRect *transport_punch_range_rect;
|
ArdourCanvas::SimpleRect *transport_punch_range_rect;
|
||||||
ArdourCanvas::Line *transport_punchin_line;
|
ArdourCanvas::SimpleLine *transport_punchin_line;
|
||||||
ArdourCanvas::Line *transport_punchout_line;
|
ArdourCanvas::SimpleLine *transport_punchout_line;
|
||||||
ArdourCanvas::SimpleRect *transport_preroll_rect;
|
ArdourCanvas::SimpleRect *transport_preroll_rect;
|
||||||
ArdourCanvas::SimpleRect *transport_postroll_rect;
|
ArdourCanvas::SimpleRect *transport_postroll_rect;
|
||||||
|
|
||||||
|
|
@ -1825,10 +1823,6 @@ class Editor : public PublicEditor
|
||||||
|
|
||||||
typedef std::map<Editing::ColorID,std::string> ColorStyleMap;
|
typedef std::map<Editing::ColorID,std::string> ColorStyleMap;
|
||||||
void init_colormap ();
|
void init_colormap ();
|
||||||
|
|
||||||
/* GTK2 stuff */
|
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::UIManager> ui_manager;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_editor_h__ */
|
#endif /* __ardour_editor_h__ */
|
||||||
|
|
|
||||||
|
|
@ -1941,8 +1941,8 @@ Editor::update_marker_drag_item (Location *location)
|
||||||
double x2 = frame_to_pixel (location->end());
|
double x2 = frame_to_pixel (location->end());
|
||||||
|
|
||||||
if (location->is_mark()) {
|
if (location->is_mark()) {
|
||||||
marker_drag_line_points->front().set_x(x1);
|
marker_drag_line_points.front().set_x(x1);
|
||||||
marker_drag_line_points->back().set_x(x1);
|
marker_drag_line_points.back().set_x(x1);
|
||||||
marker_drag_line->set_property ("points", marker_drag_line_points);
|
marker_drag_line->set_property ("points", marker_drag_line_points);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -768,31 +768,31 @@ Editor::update_tempo_based_rulers ()
|
||||||
/* Mark generation */
|
/* Mark generation */
|
||||||
|
|
||||||
gint
|
gint
|
||||||
Editor::_metric_get_smpte (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
Editor::_metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
return ruler_editor->metric_get_smpte (marks, lower, upper, maxchars);
|
return ruler_editor->metric_get_smpte (marks, lower, upper, maxchars);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
Editor::_metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
Editor::_metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
return ruler_editor->metric_get_bbt (marks, lower, upper, maxchars);
|
return ruler_editor->metric_get_bbt (marks, lower, upper, maxchars);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
Editor::_metric_get_frames (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
Editor::_metric_get_frames (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
return ruler_editor->metric_get_frames (marks, lower, upper, maxchars);
|
return ruler_editor->metric_get_frames (marks, lower, upper, maxchars);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
Editor::_metric_get_minsec (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
Editor::_metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
return ruler_editor->metric_get_minsec (marks, lower, upper, maxchars);
|
return ruler_editor->metric_get_minsec (marks, lower, upper, maxchars);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
Editor::metric_get_smpte (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
jack_nframes_t range;
|
jack_nframes_t range;
|
||||||
jack_nframes_t pos;
|
jack_nframes_t pos;
|
||||||
|
|
@ -821,7 +821,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gulong lower, gulong upper
|
||||||
upper = upper + spacer - lower;
|
upper = upper + spacer - lower;
|
||||||
lower = 0;
|
lower = 0;
|
||||||
}
|
}
|
||||||
range = upper - lower;
|
range = (jack_nframes_t) floor (upper - lower);
|
||||||
|
|
||||||
if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */
|
if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */
|
||||||
show_bits = true;
|
show_bits = true;
|
||||||
|
|
@ -900,8 +900,8 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gulong lower, gulong upper
|
||||||
nmarks = 1 + 24;
|
nmarks = 1 + 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = lower;
|
pos = (jack_nframes_t) floor (lower);
|
||||||
|
|
||||||
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
||||||
|
|
||||||
if (show_bits) {
|
if (show_bits) {
|
||||||
|
|
@ -1028,7 +1028,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gulong lower, gulong upper
|
||||||
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
Editor::metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
if (session == 0) {
|
if (session == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1059,6 +1059,8 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper,
|
||||||
BBT_Time previous_beat;
|
BBT_Time previous_beat;
|
||||||
BBT_Time next_beat;
|
BBT_Time next_beat;
|
||||||
jack_nframes_t next_beat_pos;
|
jack_nframes_t next_beat_pos;
|
||||||
|
jack_nframes_t ilower = (jack_nframes_t) floor (lower);
|
||||||
|
jack_nframes_t iupper = (jack_nframes_t) floor (upper);
|
||||||
|
|
||||||
if ((desirable_marks = maxchars / 6) == 0) {
|
if ((desirable_marks = maxchars / 6) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1085,11 +1087,11 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper,
|
||||||
|
|
||||||
/* First find what a beat's distance is, so we can start plotting stuff before the beginning of the ruler */
|
/* First find what a beat's distance is, so we can start plotting stuff before the beginning of the ruler */
|
||||||
|
|
||||||
session->bbt_time(lower,previous_beat);
|
session->bbt_time(ilower,previous_beat);
|
||||||
previous_beat.ticks = 0;
|
previous_beat.ticks = 0;
|
||||||
next_beat = previous_beat;
|
next_beat = previous_beat;
|
||||||
|
|
||||||
if (session->tempo_map().meter_at(lower).beats_per_bar() < (next_beat.beats + 1)) {
|
if (session->tempo_map().meter_at(ilower).beats_per_bar() < (next_beat.beats + 1)) {
|
||||||
next_beat.bars += 1;
|
next_beat.bars += 1;
|
||||||
next_beat.beats = 1;
|
next_beat.beats = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1099,7 +1101,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper,
|
||||||
frame_one_beats_worth = session->tempo_map().frame_time(next_beat) - session->tempo_map().frame_time(previous_beat);
|
frame_one_beats_worth = session->tempo_map().frame_time(next_beat) - session->tempo_map().frame_time(previous_beat);
|
||||||
|
|
||||||
|
|
||||||
zoomed_bbt_points = session->tempo_map().get_points((lower >= frame_one_beats_worth) ? lower - frame_one_beats_worth : 0, upper);
|
zoomed_bbt_points = session->tempo_map().get_points((ilower >= frame_one_beats_worth) ? ilower - frame_one_beats_worth : 0, iupper);
|
||||||
|
|
||||||
if (current_bbt_points == 0 || zoomed_bbt_points == 0 || zoomed_bbt_points->empty()) {
|
if (current_bbt_points == 0 || zoomed_bbt_points == 0 || zoomed_bbt_points->empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1133,7 +1135,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper,
|
||||||
bool i_am_accented = false;
|
bool i_am_accented = false;
|
||||||
bool we_need_ticks = false;
|
bool we_need_ticks = false;
|
||||||
|
|
||||||
position_of_helper = lower + (30 * Editor::get_current_zoom ());
|
position_of_helper = ilower + (30 * Editor::get_current_zoom ());
|
||||||
|
|
||||||
if (desirable_marks >= (beats * 2)) {
|
if (desirable_marks >= (beats * 2)) {
|
||||||
nmarks = (zoomed_beats * bbt_beat_subdivision) + 1;
|
nmarks = (zoomed_beats * bbt_beat_subdivision) + 1;
|
||||||
|
|
@ -1145,12 +1147,12 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper,
|
||||||
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
||||||
|
|
||||||
(*marks)[0].label = g_strdup(" ");
|
(*marks)[0].label = g_strdup(" ");
|
||||||
(*marks)[0].position = lower;
|
(*marks)[0].position = ilower;
|
||||||
(*marks)[0].style = GtkCustomRulerMarkMicro;
|
(*marks)[0].style = GtkCustomRulerMarkMicro;
|
||||||
|
|
||||||
for (n = 1, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; ++i) {
|
for (n = 1, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; ++i) {
|
||||||
|
|
||||||
if ((*i).frame <= lower && (bar_helper_on)) {
|
if ((*i).frame <= ilower && (bar_helper_on)) {
|
||||||
|
|
||||||
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
|
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
|
||||||
(*marks)[0].label = g_strdup (buf);
|
(*marks)[0].label = g_strdup (buf);
|
||||||
|
|
@ -1257,7 +1259,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper,
|
||||||
snprintf (buf, sizeof(buf), "too many bars... (currently %" PRIu32 ")", zoomed_bars );
|
snprintf (buf, sizeof(buf), "too many bars... (currently %" PRIu32 ")", zoomed_bars );
|
||||||
(*marks)[0].style = GtkCustomRulerMarkMajor;
|
(*marks)[0].style = GtkCustomRulerMarkMajor;
|
||||||
(*marks)[0].label = g_strdup (buf);
|
(*marks)[0].label = g_strdup (buf);
|
||||||
(*marks)[0].position = lower;
|
(*marks)[0].position = ilower;
|
||||||
} else if (desirable_marks < (uint32_t) (nmarks = (gint) (zoomed_bars / 64))) {
|
} else if (desirable_marks < (uint32_t) (nmarks = (gint) (zoomed_bars / 64))) {
|
||||||
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
||||||
for (n = 0, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; i++) {
|
for (n = 0, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; i++) {
|
||||||
|
|
@ -1352,10 +1354,12 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gulong lower, gulong upper,
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
Editor::metric_get_frames (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
Editor::metric_get_frames (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
jack_nframes_t mark_interval;
|
jack_nframes_t mark_interval;
|
||||||
jack_nframes_t pos;
|
jack_nframes_t pos;
|
||||||
|
jack_nframes_t ilower = (jack_nframes_t) floor (lower);
|
||||||
|
jack_nframes_t iupper = (jack_nframes_t) floor (upper);
|
||||||
gchar buf[16];
|
gchar buf[16];
|
||||||
gint nmarks;
|
gint nmarks;
|
||||||
gint n;
|
gint n;
|
||||||
|
|
@ -1364,7 +1368,7 @@ Editor::metric_get_frames (GtkCustomRulerMark **marks, gulong lower, gulong uppe
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mark_interval = (upper - lower) / 5;
|
mark_interval = (iupper - ilower) / 5;
|
||||||
if (mark_interval > session->frame_rate()) {
|
if (mark_interval > session->frame_rate()) {
|
||||||
mark_interval -= mark_interval % session->frame_rate();
|
mark_interval -= mark_interval % session->frame_rate();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1372,7 +1376,7 @@ Editor::metric_get_frames (GtkCustomRulerMark **marks, gulong lower, gulong uppe
|
||||||
}
|
}
|
||||||
nmarks = 5;
|
nmarks = 5;
|
||||||
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
||||||
for (n = 0, pos = lower; n < nmarks; pos += mark_interval, ++n) {
|
for (n = 0, pos = ilower; n < nmarks; pos += mark_interval, ++n) {
|
||||||
snprintf (buf, sizeof(buf), "%u", pos);
|
snprintf (buf, sizeof(buf), "%u", pos);
|
||||||
(*marks)[n].label = g_strdup (buf);
|
(*marks)[n].label = g_strdup (buf);
|
||||||
(*marks)[n].position = pos;
|
(*marks)[n].position = pos;
|
||||||
|
|
@ -1415,7 +1419,7 @@ sample_to_clock_parts ( jack_nframes_t sample,
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
Editor::metric_get_minsec (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
jack_nframes_t range;
|
jack_nframes_t range;
|
||||||
jack_nframes_t fr;
|
jack_nframes_t fr;
|
||||||
|
|
@ -1430,6 +1434,8 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gulong lower, gulong uppe
|
||||||
bool show_seconds = false;
|
bool show_seconds = false;
|
||||||
bool show_minutes = false;
|
bool show_minutes = false;
|
||||||
bool show_hours = false;
|
bool show_hours = false;
|
||||||
|
jack_nframes_t ilower = (jack_nframes_t) floor (lower);
|
||||||
|
jack_nframes_t iupper = (jack_nframes_t) floor (upper);
|
||||||
|
|
||||||
if (session == 0) {
|
if (session == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1444,7 +1450,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gulong lower, gulong uppe
|
||||||
upper = upper + spacer;
|
upper = upper + spacer;
|
||||||
lower = 0;
|
lower = 0;
|
||||||
}
|
}
|
||||||
range = upper - lower;
|
range = iupper - ilower;
|
||||||
|
|
||||||
if (range < (fr / 50)) {
|
if (range < (fr / 50)) {
|
||||||
mark_interval = fr / 100; /* show 1/100 seconds */
|
mark_interval = fr / 100; /* show 1/100 seconds */
|
||||||
|
|
@ -1517,7 +1523,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gulong lower, gulong uppe
|
||||||
|
|
||||||
nmarks = 1 + (range / mark_interval);
|
nmarks = 1 + (range / mark_interval);
|
||||||
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
||||||
pos = ((lower + (mark_interval/2))/mark_interval) * mark_interval;
|
pos = ((ilower + (mark_interval/2))/mark_interval) * mark_interval;
|
||||||
|
|
||||||
if (show_seconds) {
|
if (show_seconds) {
|
||||||
for (n = 0; n < nmarks; pos += mark_interval, ++n) {
|
for (n = 0; n < nmarks; pos += mark_interval, ++n) {
|
||||||
|
|
|
||||||
|
|
@ -46,22 +46,28 @@ static void gtk_custom_hruler_draw_pos (GtkCustomRuler * ruler);
|
||||||
|
|
||||||
guint gtk_custom_hruler_get_type (void)
|
guint gtk_custom_hruler_get_type (void)
|
||||||
{
|
{
|
||||||
static guint custom_hruler_type = 0;
|
static GType hruler_type = 0;
|
||||||
|
|
||||||
if (!custom_hruler_type) {
|
if (!hruler_type)
|
||||||
static const GtkTypeInfo custom_hruler_info = {
|
{
|
||||||
"GtkCustomHRuler",
|
static const GTypeInfo hruler_info =
|
||||||
sizeof (GtkCustomHRuler),
|
{
|
||||||
sizeof (GtkCustomHRulerClass),
|
sizeof (GtkCustomHRulerClass),
|
||||||
(GtkClassInitFunc) gtk_custom_hruler_class_init,
|
NULL, /* base_init */
|
||||||
(GtkObjectInitFunc) gtk_custom_hruler_init,
|
NULL, /* base_finalize */
|
||||||
/* reserved_1 */ NULL,
|
(GClassInitFunc) gtk_custom_hruler_class_init,
|
||||||
/* reserved_2 */ NULL,
|
NULL, /* class_finalize */
|
||||||
(GtkClassInitFunc) NULL,
|
NULL, /* class_data */
|
||||||
};
|
sizeof (GtkCustomHRuler),
|
||||||
custom_hruler_type = gtk_type_unique (gtk_custom_ruler_get_type (), &custom_hruler_info);
|
0, /* n_preallocs */
|
||||||
|
(GInstanceInitFunc) gtk_custom_hruler_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
hruler_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCustomHRuler",
|
||||||
|
&hruler_info, 0);
|
||||||
}
|
}
|
||||||
return custom_hruler_type;
|
|
||||||
|
return hruler_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,12 @@
|
||||||
#include "gtk-custom-ruler.h"
|
#include "gtk-custom-ruler.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
G_BEGIN_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#define GTK_CUSTOM_HRULER(obj) GTK_CHECK_CAST (obj, gtk_custom_hruler_get_type (), GtkCustomHRuler)
|
#define GTK_CUSTOM_HRULER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_custom_hruler_get_type (), GtkCustomHRuler)
|
||||||
#define GTK_CUSTOM_HRULER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_custom_hruler_get_type (), GtkCustomHRulerClass)
|
#define GTK_CUSTOM_HRULER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gtk_custom_hruler_get_type (), GtkCustomHRulerClass)
|
||||||
#define GTK_IS_CUSTOM_HRULER(obj) GTK_CHECK_TYPE (obj, gtk_custom_hruler_get_type ())
|
#define GTK_IS_CUSTOM_HRULER(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_custom_hruler_get_type ())
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GtkCustomHRuler GtkCustomHRuler;
|
typedef struct _GtkCustomHRuler GtkCustomHRuler;
|
||||||
|
|
@ -62,9 +60,7 @@ guint gtk_custom_hruler_get_type (void);
|
||||||
GtkWidget* gtk_custom_hruler_new (void);
|
GtkWidget* gtk_custom_hruler_new (void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
G_END_DECLS
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GTK_CUSTOM_HRULER_H__ */
|
#endif /* __GTK_CUSTOM_HRULER_H__ */
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,19 @@
|
||||||
/* modified by andreas meyer <hexx3000@gmx.de> */
|
/* modified by andreas meyer <hexx3000@gmx.de> */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "gettext.h"
|
||||||
|
#define _(Text) dgettext (PACKAGE,Text)
|
||||||
|
|
||||||
#include "gtk-custom-ruler.h"
|
#include "gtk-custom-ruler.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ARG_0,
|
PROP_0,
|
||||||
ARG_LOWER,
|
PROP_LOWER,
|
||||||
ARG_UPPER,
|
PROP_UPPER,
|
||||||
ARG_POSITION,
|
PROP_POSITION,
|
||||||
ARG_MAX_SIZE,
|
PROP_MAX_SIZE,
|
||||||
ARG_SHOW_POSITION
|
PROP_SHOW_POSITION
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gtk_custom_ruler_class_init (GtkCustomRulerClass * klass);
|
static void gtk_custom_ruler_class_init (GtkCustomRulerClass * klass);
|
||||||
|
|
@ -46,11 +49,18 @@ static void gtk_custom_ruler_unrealize (GtkWidget * widget);
|
||||||
static void gtk_custom_ruler_size_allocate (GtkWidget * widget, GtkAllocation * allocation);
|
static void gtk_custom_ruler_size_allocate (GtkWidget * widget, GtkAllocation * allocation);
|
||||||
static gint gtk_custom_ruler_expose (GtkWidget * widget, GdkEventExpose * event);
|
static gint gtk_custom_ruler_expose (GtkWidget * widget, GdkEventExpose * event);
|
||||||
static void gtk_custom_ruler_make_pixmap (GtkCustomRuler * ruler);
|
static void gtk_custom_ruler_make_pixmap (GtkCustomRuler * ruler);
|
||||||
static void gtk_custom_ruler_set_arg (GtkObject * object, GtkArg * arg, guint arg_id);
|
static void gtk_custom_ruler_set_property (GObject *object,
|
||||||
static void gtk_custom_ruler_get_arg (GtkObject * object, GtkArg * arg, guint arg_id);
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec);
|
||||||
|
static void gtk_custom_ruler_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec);
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
default_metric_get_marks (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars)
|
default_metric_get_marks (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -64,38 +74,44 @@ static GtkWidgetClass *parent_class;
|
||||||
|
|
||||||
GtkType gtk_custom_ruler_get_type (void)
|
GtkType gtk_custom_ruler_get_type (void)
|
||||||
{
|
{
|
||||||
static GtkType ruler_type = 0;
|
static GType ruler_type = 0;
|
||||||
|
|
||||||
if (!ruler_type) {
|
if (!ruler_type)
|
||||||
static const GtkTypeInfo ruler_info = {
|
{
|
||||||
"GtkCustomRuler",
|
static const GTypeInfo ruler_info =
|
||||||
sizeof (GtkCustomRuler),
|
{
|
||||||
sizeof (GtkCustomRulerClass),
|
sizeof (GtkCustomRulerClass),
|
||||||
(GtkClassInitFunc) gtk_custom_ruler_class_init,
|
NULL, /* base_init */
|
||||||
(GtkObjectInitFunc) gtk_custom_ruler_init,
|
NULL, /* base_finalize */
|
||||||
/* reserved_1 */ NULL,
|
(GClassInitFunc) gtk_custom_ruler_class_init,
|
||||||
/* reserved_2 */ NULL,
|
NULL, /* class_finalize */
|
||||||
(GtkClassInitFunc) NULL,
|
NULL, /* class_data */
|
||||||
};
|
sizeof (GtkCustomRuler),
|
||||||
ruler_type = gtk_type_unique (GTK_TYPE_WIDGET, &ruler_info);
|
0, /* n_preallocs */
|
||||||
|
(GInstanceInitFunc) gtk_custom_ruler_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
ruler_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCustomRuler",
|
||||||
|
&ruler_info, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ruler_type;
|
return ruler_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_custom_ruler_class_init (GtkCustomRulerClass * class)
|
gtk_custom_ruler_class_init (GtkCustomRulerClass * class)
|
||||||
{
|
{
|
||||||
GtkObjectClass *object_class;
|
GObjectClass *gobject_class;
|
||||||
GtkWidgetClass *widget_class;
|
GtkWidgetClass *widget_class;
|
||||||
|
|
||||||
object_class = (GtkObjectClass *) class;
|
gobject_class = G_OBJECT_CLASS (class);
|
||||||
widget_class = (GtkWidgetClass *) class;
|
widget_class = (GtkWidgetClass*) class;
|
||||||
|
|
||||||
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
|
parent_class = g_type_class_peek_parent (class);
|
||||||
|
|
||||||
object_class->set_arg = gtk_custom_ruler_set_arg;
|
gobject_class->set_property = gtk_custom_ruler_set_property;
|
||||||
object_class->get_arg = gtk_custom_ruler_get_arg;
|
gobject_class->get_property = gtk_custom_ruler_get_property;
|
||||||
|
|
||||||
widget_class->realize = gtk_custom_ruler_realize;
|
widget_class->realize = gtk_custom_ruler_realize;
|
||||||
widget_class->unrealize = gtk_custom_ruler_unrealize;
|
widget_class->unrealize = gtk_custom_ruler_unrealize;
|
||||||
widget_class->size_allocate = gtk_custom_ruler_size_allocate;
|
widget_class->size_allocate = gtk_custom_ruler_size_allocate;
|
||||||
|
|
@ -104,11 +120,53 @@ gtk_custom_ruler_class_init (GtkCustomRulerClass * class)
|
||||||
class->draw_ticks = NULL;
|
class->draw_ticks = NULL;
|
||||||
class->draw_pos = NULL;
|
class->draw_pos = NULL;
|
||||||
|
|
||||||
gtk_object_add_arg_type ("GtkCustomRuler::lower", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_LOWER);
|
g_object_class_install_property (gobject_class,
|
||||||
gtk_object_add_arg_type ("GtkCustomRuler::upper", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_UPPER);
|
PROP_LOWER,
|
||||||
gtk_object_add_arg_type ("GtkCustomRuler::position", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_POSITION);
|
g_param_spec_double ("lower",
|
||||||
gtk_object_add_arg_type ("GtkCustomRuler::max_size", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_MAX_SIZE);
|
_("Lower"),
|
||||||
gtk_object_add_arg_type ("GtkCustomRuler::show_position", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SHOW_POSITION);
|
_("Lower limit of ruler"),
|
||||||
|
-G_MAXDOUBLE,
|
||||||
|
G_MAXDOUBLE,
|
||||||
|
0.0,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_UPPER,
|
||||||
|
g_param_spec_double ("upper",
|
||||||
|
_("Upper"),
|
||||||
|
_("Upper limit of ruler"),
|
||||||
|
-G_MAXDOUBLE,
|
||||||
|
G_MAXDOUBLE,
|
||||||
|
0.0,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_POSITION,
|
||||||
|
g_param_spec_double ("position",
|
||||||
|
_("Position"),
|
||||||
|
_("Position of mark on the ruler"),
|
||||||
|
-G_MAXDOUBLE,
|
||||||
|
G_MAXDOUBLE,
|
||||||
|
0.0,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_MAX_SIZE,
|
||||||
|
g_param_spec_double ("max_size",
|
||||||
|
_("Max Size"),
|
||||||
|
_("Maximum size of the ruler"),
|
||||||
|
-G_MAXDOUBLE,
|
||||||
|
G_MAXDOUBLE,
|
||||||
|
0.0,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_SHOW_POSITION,
|
||||||
|
g_param_spec_boolean ("show_position",
|
||||||
|
_("Show Position"),
|
||||||
|
_("Draw current ruler position"),
|
||||||
|
TRUE,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -129,54 +187,66 @@ gtk_custom_ruler_init (GtkCustomRuler * ruler)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_custom_ruler_set_arg (GtkObject * object, GtkArg * arg, guint arg_id)
|
gtk_custom_ruler_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkCustomRuler *ruler = GTK_CUSTOM_RULER (object);
|
GtkCustomRuler *ruler = GTK_CUSTOM_RULER (object);
|
||||||
|
|
||||||
switch (arg_id) {
|
switch (prop_id)
|
||||||
case ARG_LOWER:
|
{
|
||||||
gtk_custom_ruler_set_range (ruler, GTK_VALUE_ULONG (*arg), ruler->upper, ruler->position, ruler->max_size);
|
case PROP_LOWER:
|
||||||
break;
|
gtk_custom_ruler_set_range (ruler, g_value_get_double (value), ruler->upper,
|
||||||
case ARG_UPPER:
|
ruler->position, ruler->max_size);
|
||||||
gtk_custom_ruler_set_range (ruler, ruler->lower, GTK_VALUE_ULONG (*arg), ruler->position, ruler->max_size);
|
break;
|
||||||
break;
|
case PROP_UPPER:
|
||||||
case ARG_POSITION:
|
gtk_custom_ruler_set_range (ruler, ruler->lower, g_value_get_double (value),
|
||||||
gtk_custom_ruler_set_range (ruler, ruler->lower, ruler->upper, GTK_VALUE_ULONG (*arg), ruler->max_size);
|
ruler->position, ruler->max_size);
|
||||||
break;
|
break;
|
||||||
case ARG_MAX_SIZE:
|
case PROP_POSITION:
|
||||||
gtk_custom_ruler_set_range (ruler, ruler->lower, ruler->upper, ruler->position, GTK_VALUE_ULONG (*arg));
|
gtk_custom_ruler_set_range (ruler, ruler->lower, ruler->upper,
|
||||||
break;
|
g_value_get_double (value), ruler->max_size);
|
||||||
case ARG_SHOW_POSITION:
|
break;
|
||||||
// gtk_customer_ruler_set_show_position (ruler, GTK_VALUE_BOOL (*arg));
|
case PROP_MAX_SIZE:
|
||||||
break;
|
gtk_custom_ruler_set_range (ruler, ruler->lower, ruler->upper,
|
||||||
}
|
ruler->position, g_value_get_double (value));
|
||||||
|
break;
|
||||||
|
case PROP_SHOW_POSITION:
|
||||||
|
gtk_custom_ruler_set_show_position (ruler, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_custom_ruler_get_arg (GtkObject * object, GtkArg * arg, guint arg_id)
|
gtk_custom_ruler_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkCustomRuler *ruler = GTK_CUSTOM_RULER (object);
|
GtkCustomRuler *ruler = GTK_CUSTOM_RULER (object);
|
||||||
|
|
||||||
switch (arg_id) {
|
switch (prop_id)
|
||||||
case ARG_LOWER:
|
{
|
||||||
GTK_VALUE_ULONG (*arg) = ruler->lower;
|
case PROP_LOWER:
|
||||||
break;
|
g_value_set_double (value, ruler->lower);
|
||||||
case ARG_UPPER:
|
break;
|
||||||
GTK_VALUE_ULONG (*arg) = ruler->upper;
|
case PROP_UPPER:
|
||||||
break;
|
g_value_set_double (value, ruler->upper);
|
||||||
case ARG_POSITION:
|
break;
|
||||||
GTK_VALUE_ULONG (*arg) = ruler->position;
|
case PROP_POSITION:
|
||||||
break;
|
g_value_set_double (value, ruler->position);
|
||||||
case ARG_MAX_SIZE:
|
break;
|
||||||
GTK_VALUE_ULONG (*arg) = ruler->max_size;
|
case PROP_MAX_SIZE:
|
||||||
break;
|
g_value_set_double (value, ruler->max_size);
|
||||||
case ARG_SHOW_POSITION:
|
break;
|
||||||
GTK_VALUE_BOOL (*arg) = ruler->show_position;
|
case PROP_SHOW_POSITION:
|
||||||
break;
|
g_value_set_boolean (value, ruler->show_position);
|
||||||
default:
|
break;
|
||||||
arg->type = GTK_TYPE_INVALID;
|
default:
|
||||||
break;
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -195,18 +265,70 @@ gtk_custom_ruler_set_metric (GtkCustomRuler * ruler, GtkCustomMetric * metric)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_custom_ruler_set_range (GtkCustomRuler * ruler, gulong lower, gulong upper, gulong position, gulong max_size)
|
gtk_custom_ruler_set_range (GtkCustomRuler *ruler,
|
||||||
|
gdouble lower,
|
||||||
|
gdouble upper,
|
||||||
|
gdouble position,
|
||||||
|
gdouble max_size)
|
||||||
{
|
{
|
||||||
g_return_if_fail (ruler != NULL);
|
g_return_if_fail (GTK_IS_CUSTOM_RULER (ruler));
|
||||||
g_return_if_fail (GTK_IS_CUSTOM_RULER (ruler));
|
|
||||||
|
|
||||||
ruler->lower = lower;
|
g_object_freeze_notify (G_OBJECT (ruler));
|
||||||
ruler->upper = upper;
|
if (ruler->lower != lower)
|
||||||
ruler->position = position;
|
{
|
||||||
ruler->max_size = max_size;
|
ruler->lower = lower;
|
||||||
|
g_object_notify (G_OBJECT (ruler), "lower");
|
||||||
|
}
|
||||||
|
if (ruler->upper != upper)
|
||||||
|
{
|
||||||
|
ruler->upper = upper;
|
||||||
|
g_object_notify (G_OBJECT (ruler), "upper");
|
||||||
|
}
|
||||||
|
if (ruler->position != position)
|
||||||
|
{
|
||||||
|
ruler->position = position;
|
||||||
|
g_object_notify (G_OBJECT (ruler), "position");
|
||||||
|
}
|
||||||
|
if (ruler->max_size != max_size)
|
||||||
|
{
|
||||||
|
ruler->max_size = max_size;
|
||||||
|
g_object_notify (G_OBJECT (ruler), "max-size");
|
||||||
|
}
|
||||||
|
g_object_thaw_notify (G_OBJECT (ruler));
|
||||||
|
|
||||||
if (GTK_WIDGET_DRAWABLE (ruler))
|
if (GTK_WIDGET_DRAWABLE (ruler))
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (ruler));
|
gtk_widget_queue_draw (GTK_WIDGET (ruler));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_custom_ruler_get_range:
|
||||||
|
* @ruler: a #GtkCustomRuler
|
||||||
|
* @lower: location to store lower limit of the ruler, or %NULL
|
||||||
|
* @upper: location to store upper limit of the ruler, or %NULL
|
||||||
|
* @position: location to store the current position of the mark on the ruler, or %NULL
|
||||||
|
* @max_size: location to store the maximum size of the ruler used when calculating
|
||||||
|
* the space to leave for the text, or %NULL.
|
||||||
|
*
|
||||||
|
* Retrieves values indicating the range and current position of a #GtkCustomRuler.
|
||||||
|
* See gtk_custom_ruler_set_range().
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gtk_custom_ruler_get_range (GtkCustomRuler *ruler,
|
||||||
|
gdouble *lower,
|
||||||
|
gdouble *upper,
|
||||||
|
gdouble *position,
|
||||||
|
gdouble *max_size)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_CUSTOM_RULER (ruler));
|
||||||
|
|
||||||
|
if (lower)
|
||||||
|
*lower = ruler->lower;
|
||||||
|
if (upper)
|
||||||
|
*upper = ruler->upper;
|
||||||
|
if (position)
|
||||||
|
*position = ruler->position;
|
||||||
|
if (max_size)
|
||||||
|
*max_size = ruler->max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -269,43 +391,38 @@ gtk_custom_ruler_realize (GtkWidget * widget)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_custom_ruler_unrealize (GtkWidget * widget)
|
gtk_custom_ruler_unrealize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkCustomRuler *ruler;
|
GtkCustomRuler *ruler = GTK_CUSTOM_RULER (widget);
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
if (ruler->backing_store)
|
||||||
g_return_if_fail (GTK_IS_CUSTOM_RULER (widget));
|
g_object_unref (ruler->backing_store);
|
||||||
|
if (ruler->non_gr_exp_gc)
|
||||||
|
g_object_unref (ruler->non_gr_exp_gc);
|
||||||
|
|
||||||
ruler = GTK_CUSTOM_RULER (widget);
|
ruler->backing_store = NULL;
|
||||||
|
ruler->non_gr_exp_gc = NULL;
|
||||||
|
|
||||||
if (ruler->backing_store)
|
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
|
||||||
gdk_pixmap_unref (ruler->backing_store);
|
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
|
||||||
if (ruler->non_gr_exp_gc)
|
|
||||||
gdk_gc_destroy (ruler->non_gr_exp_gc);
|
|
||||||
|
|
||||||
ruler->backing_store = NULL;
|
|
||||||
ruler->non_gr_exp_gc = NULL;
|
|
||||||
|
|
||||||
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
|
|
||||||
(*GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_custom_ruler_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
|
gtk_custom_ruler_size_allocate (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation)
|
||||||
{
|
{
|
||||||
GtkCustomRuler *ruler;
|
GtkCustomRuler *ruler = GTK_CUSTOM_RULER (widget);
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
widget->allocation = *allocation;
|
||||||
g_return_if_fail (GTK_IS_CUSTOM_RULER (widget));
|
|
||||||
|
|
||||||
ruler = GTK_CUSTOM_RULER (widget);
|
if (GTK_WIDGET_REALIZED (widget))
|
||||||
widget->allocation = *allocation;
|
{
|
||||||
|
gdk_window_move_resize (widget->window,
|
||||||
|
allocation->x, allocation->y,
|
||||||
|
allocation->width, allocation->height);
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (widget)) {
|
gtk_custom_ruler_make_pixmap (ruler);
|
||||||
gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height);
|
}
|
||||||
|
|
||||||
gtk_custom_ruler_make_pixmap (ruler);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
|
@ -332,32 +449,39 @@ gtk_custom_ruler_expose (GtkWidget * widget, GdkEventExpose * event)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_custom_ruler_make_pixmap (GtkCustomRuler * ruler)
|
gtk_custom_ruler_make_pixmap (GtkCustomRuler *ruler)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
|
|
||||||
widget = GTK_WIDGET (ruler);
|
widget = GTK_WIDGET (ruler);
|
||||||
|
|
||||||
if (ruler->backing_store) {
|
if (ruler->backing_store)
|
||||||
gdk_window_get_size (ruler->backing_store, &width, &height);
|
{
|
||||||
if ((width == widget->allocation.width) && (height == widget->allocation.height))
|
gdk_drawable_get_size (ruler->backing_store, &width, &height);
|
||||||
return;
|
if ((width == widget->allocation.width) &&
|
||||||
|
(height == widget->allocation.height))
|
||||||
|
return;
|
||||||
|
|
||||||
gdk_pixmap_unref (ruler->backing_store);
|
g_object_unref (ruler->backing_store);
|
||||||
}
|
}
|
||||||
|
|
||||||
ruler->backing_store = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1);
|
ruler->backing_store = gdk_pixmap_new (widget->window,
|
||||||
|
widget->allocation.width,
|
||||||
|
widget->allocation.height,
|
||||||
|
-1);
|
||||||
|
|
||||||
ruler->xsrc = 0;
|
ruler->xsrc = 0;
|
||||||
ruler->ysrc = 0;
|
ruler->ysrc = 0;
|
||||||
|
|
||||||
if (!ruler->non_gr_exp_gc) {
|
if (!ruler->non_gr_exp_gc)
|
||||||
ruler->non_gr_exp_gc = gdk_gc_new (widget->window);
|
{
|
||||||
gdk_gc_set_exposures (ruler->non_gr_exp_gc, FALSE);
|
ruler->non_gr_exp_gc = gdk_gc_new (widget->window);
|
||||||
}
|
gdk_gc_set_exposures (ruler->non_gr_exp_gc, FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -33,15 +33,14 @@
|
||||||
#include <gtk/gtkwidget.h>
|
#include <gtk/gtkwidget.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
G_BEGIN_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#define GTK_TYPE_CUSTOM_RULER (gtk_custom_ruler_get_type ())
|
#define GTK_TYPE_CUSTOM_RULER (gtk_custom_ruler_get_type ())
|
||||||
#define GTK_CUSTOM_RULER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CUSTOM_RULER, GtkCustomRuler))
|
#define GTK_CUSTOM_RULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CUSTOM_RULER, GtkCustomRuler))
|
||||||
#define GTK_CUSTOM_RULER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CUSTOM_RULER, GtkCustomRulerClass))
|
#define GTK_CUSTOM_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CUSTOM_RULER, GtkCustomRulerClass))
|
||||||
#define GTK_IS_CUSTOM_RULER(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CUSTOM_RULER))
|
#define GTK_IS_CUSTOM_RULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CUSTOM_RULER))
|
||||||
#define GTK_IS_CUSTOM_RULER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CUSTOM_RULER))
|
#define GTK_IS_CUSTOM_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CUSTOM_RULER))
|
||||||
|
#define GTK_CUSTOM_RULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CUSTOM_RULER, GtkCustomRulerClass))
|
||||||
|
|
||||||
typedef struct _GtkCustomRuler GtkCustomRuler;
|
typedef struct _GtkCustomRuler GtkCustomRuler;
|
||||||
typedef struct _GtkCustomRulerClass GtkCustomRulerClass;
|
typedef struct _GtkCustomRulerClass GtkCustomRulerClass;
|
||||||
|
|
@ -59,13 +58,13 @@ struct _GtkCustomRuler {
|
||||||
gboolean show_position;
|
gboolean show_position;
|
||||||
|
|
||||||
/* The upper limit of the ruler (in points) */
|
/* The upper limit of the ruler (in points) */
|
||||||
gulong lower;
|
gdouble lower;
|
||||||
/* The lower limit of the ruler */
|
/* The lower limit of the ruler */
|
||||||
gulong upper;
|
gdouble upper;
|
||||||
/* The position of the mark on the ruler */
|
/* The position of the mark on the ruler */
|
||||||
gulong position;
|
gdouble position;
|
||||||
/* The maximum size of the ruler */
|
/* The maximum size of the ruler */
|
||||||
gulong max_size;
|
gdouble max_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCustomRulerClass {
|
struct _GtkCustomRulerClass {
|
||||||
|
|
@ -83,29 +82,26 @@ typedef enum {
|
||||||
|
|
||||||
struct _GtkCustomRulerMark {
|
struct _GtkCustomRulerMark {
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gulong position;
|
gdouble position;
|
||||||
GtkCustomRulerMarkStyle style;
|
GtkCustomRulerMarkStyle style;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCustomMetric {
|
struct _GtkCustomMetric {
|
||||||
gfloat units_per_pixel;
|
gfloat units_per_pixel;
|
||||||
gint (* get_marks) (GtkCustomRulerMark **marks, gulong lower, gulong upper, gint maxchars);
|
gint (* get_marks) (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars);
|
||||||
};
|
};
|
||||||
|
|
||||||
GtkType gtk_custom_ruler_get_type (void);
|
GtkType gtk_custom_ruler_get_type (void);
|
||||||
void gtk_custom_ruler_set_metric (GtkCustomRuler *ruler, GtkCustomMetric *metric);
|
void gtk_custom_ruler_set_metric (GtkCustomRuler *ruler, GtkCustomMetric *metric);
|
||||||
void gtk_custom_ruler_set_range (GtkCustomRuler *ruler,
|
void gtk_custom_ruler_set_range (GtkCustomRuler *ruler,
|
||||||
gulong lower,
|
gdouble lower,
|
||||||
gulong upper,
|
gdouble upper,
|
||||||
gulong position,
|
gdouble position,
|
||||||
gulong max_size);
|
gdouble max_size);
|
||||||
void gtk_custom_ruler_draw_ticks (GtkCustomRuler *ruler);
|
void gtk_custom_ruler_draw_ticks (GtkCustomRuler *ruler);
|
||||||
void gtk_custom_ruler_draw_pos (GtkCustomRuler *ruler);
|
void gtk_custom_ruler_draw_pos (GtkCustomRuler *ruler);
|
||||||
void gtk_custom_ruler_set_show_position (GtkCustomRuler *rule, gboolean yn);
|
void gtk_custom_ruler_set_show_position (GtkCustomRuler *rule, gboolean yn);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
G_END_DECLS
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GTK_CUSTOM_RULER_H__ */
|
#endif /* __GTK_CUSTOM_RULER_H__ */
|
||||||
|
|
|
||||||
|
|
@ -167,12 +167,18 @@ Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_drawwidth() const
|
||||||
{
|
{
|
||||||
return Glib::PropertyProxy_ReadOnly<double> (this, "drawwidth");
|
return Glib::PropertyProxy_ReadOnly<double> (this, "drawwidth");
|
||||||
}
|
}
|
||||||
|
Glib::PropertyProxy<double> ImageFrame::property_height()
|
||||||
|
{
|
||||||
|
return Glib::PropertyProxy<double> (this, "height");
|
||||||
|
}
|
||||||
|
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_height() const
|
||||||
|
{
|
||||||
|
return Glib::PropertyProxy_ReadOnly<double> (this, "height");
|
||||||
|
}
|
||||||
Glib::PropertyProxy<Gtk::AnchorType> ImageFrame::property_anchor()
|
Glib::PropertyProxy<Gtk::AnchorType> ImageFrame::property_anchor()
|
||||||
{
|
{
|
||||||
return Glib::PropertyProxy<Gtk::AnchorType>(this, "anchor");
|
return Glib::PropertyProxy<Gtk::AnchorType>(this, "anchor");
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> ImageFrame::property_anchor() const
|
Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> ImageFrame::property_anchor() const
|
||||||
{
|
{
|
||||||
return Glib::PropertyProxy_ReadOnly<Gtk::AnchorType>(this, "anchor");
|
return Glib::PropertyProxy_ReadOnly<Gtk::AnchorType>(this, "anchor");
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,6 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
|
||||||
|
|
||||||
track_display.get_selection()->signal_changed().connect (mem_fun(*this, &Mixer_UI::track_display_selection_changed));
|
track_display.get_selection()->signal_changed().connect (mem_fun(*this, &Mixer_UI::track_display_selection_changed));
|
||||||
track_display_model->signal_rows_reordered().connect (mem_fun (*this, &Mixer_UI::track_display_reordered_proxy));
|
track_display_model->signal_rows_reordered().connect (mem_fun (*this, &Mixer_UI::track_display_reordered_proxy));
|
||||||
track_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::track_display_button_press));
|
|
||||||
|
|
||||||
group_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::group_display_button_press));
|
group_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::group_display_button_press));
|
||||||
group_display.get_selection()->signal_changed().connect (mem_fun (*this, &Mixer_UI::group_display_selection_changed));
|
group_display.get_selection()->signal_changed().connect (mem_fun (*this, &Mixer_UI::group_display_selection_changed));
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "glade_path.h"
|
#include "glade_path.h"
|
||||||
|
|
||||||
const char* NewSessionDialogFactory::s_m_top_level_widget_name = X_("new_session_dialog");
|
const char* NewSessionDialogFactory::s_m_top_level_widget_name = X_("new_session_dialog");
|
||||||
|
const char* NewSessionDialogFactory::top_level_widget_name() { return s_m_top_level_widget_name; }
|
||||||
|
|
||||||
Glib::RefPtr<Gnome::Glade::Xml>
|
Glib::RefPtr<Gnome::Glade::Xml>
|
||||||
NewSessionDialogFactory::create()
|
NewSessionDialogFactory::create()
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ AudioRegionEditor::AudioRegionEditor (Session&s, AudioRegion& r, AudioRegionView
|
||||||
|
|
||||||
fade_in_length_spinner.set_digits (3);
|
fade_in_length_spinner.set_digits (3);
|
||||||
|
|
||||||
fade_in_length_spinner.signal_activate().connect (mem_fun(*this, &AudioRegionEditor::activation));
|
// fade_in_length_spinner.signal_activate().connect (mem_fun(*this, &AudioRegionEditor::activation));
|
||||||
|
|
||||||
Gtkmm2ext::set_size_request_to_display_given_text (fade_in_length_spinner, "500g", 20, -1);
|
Gtkmm2ext::set_size_request_to_display_given_text (fade_in_length_spinner, "500g", 20, -1);
|
||||||
|
|
||||||
|
|
@ -368,10 +368,11 @@ AudioRegionEditor::bpressed (GdkEventButton* ev, Gtk::SpinButton* but, void (Aud
|
||||||
case 3:
|
case 3:
|
||||||
if (ev->type == GDK_BUTTON_PRESS) { /* no double clicks here */
|
if (ev->type == GDK_BUTTON_PRESS) { /* no double clicks here */
|
||||||
if (!spin_arrow_grab) {
|
if (!spin_arrow_grab) {
|
||||||
if ((ev->window == but->gobj()->panel)) {
|
// GTK2FIX probably nuke the region editor
|
||||||
spin_arrow_grab = true;
|
// if ((ev->window == but->gobj()->panel)) {
|
||||||
(this->*pmf)();
|
// spin_arrow_grab = true;
|
||||||
}
|
// (this->*pmf)();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -618,7 +619,7 @@ AudioRegionEditor::bounds_changed (Change what_changed)
|
||||||
void
|
void
|
||||||
AudioRegionEditor::activation ()
|
AudioRegionEditor::activation ()
|
||||||
{
|
{
|
||||||
ARDOUR_UI::instance()->allow_focus (false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,7 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
AudioRegionGainLine::AudioRegionGainLine (string name, Session& s, AudioRegionView& r, ArdourCanvas::Group& parent,
|
AudioRegionGainLine::AudioRegionGainLine (string name, Session& s, AudioRegionView& r, ArdourCanvas::Group& parent, Curve& c)
|
||||||
Curve& c,
|
|
||||||
bool (*point_callback)(ArdourCanvas::Item*, GdkEvent*, gpointer),
|
|
||||||
bool (*line_callback)(ArdourCanvas::Item*, GdkEvent*, gpointer))
|
|
||||||
: AutomationLine (name, r.get_time_axis_view(), parent, c),
|
: AutomationLine (name, r.get_time_axis_view(), parent, c),
|
||||||
session (s),
|
session (s),
|
||||||
rv (r)
|
rv (r)
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,7 @@ class AudioRegionView;
|
||||||
class AudioRegionGainLine : public AutomationLine
|
class AudioRegionGainLine : public AutomationLine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AudioRegionGainLine (string name, ARDOUR::Session&, AudioRegionView&, ArdourCanvas::Group& parent,
|
AudioRegionGainLine (string name, ARDOUR::Session&, AudioRegionView&, ArdourCanvas::Group& parent, ARDOUR::Curve&);
|
||||||
ARDOUR::Curve&,
|
|
||||||
bool (*point_callback)(ArdourCanvas::Item*, GdkEvent*, gpointer),
|
|
||||||
bool (*line_callback)(ArdourCanvas::Item*, GdkEvent*, gpointer));
|
|
||||||
|
|
||||||
void view_to_model_y (double&);
|
void view_to_model_y (double&);
|
||||||
void model_to_view_y (double&);
|
void model_to_view_y (double&);
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,8 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView
|
||||||
|
|
||||||
create_waves ();
|
create_waves ();
|
||||||
|
|
||||||
gtk_object_set_data (GTK_OBJECT(name_highlight), "regionview", this);
|
name_highlight->set_data ("regionview", this);
|
||||||
gtk_object_set_data (GTK_OBJECT(name_text), "regionview", this);
|
name_text->set_data ("regionview", this);
|
||||||
|
|
||||||
// shape = new ArdourCanvas::Points ();
|
// shape = new ArdourCanvas::Points ();
|
||||||
|
|
||||||
|
|
@ -151,9 +151,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView
|
||||||
foo += ':';
|
foo += ':';
|
||||||
foo += "gain";
|
foo += "gain";
|
||||||
|
|
||||||
gain_line = new AudioRegionGainLine (foo, tv.session(), *this, *group, region.envelope(),
|
gain_line = new AudioRegionGainLine (foo, tv.session(), *this, *group, region.envelope());
|
||||||
PublicEditor::canvas_control_point_event,
|
|
||||||
PublicEditor::canvas_line_event);
|
|
||||||
|
|
||||||
if (!(_flags & EnvelopeVisible)) {
|
if (!(_flags & EnvelopeVisible)) {
|
||||||
gain_line->hide ();
|
gain_line->hide ();
|
||||||
|
|
@ -178,13 +176,12 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView
|
||||||
|
|
||||||
region.StateChanged.connect (mem_fun(*this, &AudioRegionView::region_changed));
|
region.StateChanged.connect (mem_fun(*this, &AudioRegionView::region_changed));
|
||||||
|
|
||||||
group->signal_event().connect (bind (mem_fun (editor, &PublicEditor::UNC (PublicEditor::canvas_region_view_event)), group, this));
|
group->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
|
||||||
region_view_name_highlight->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_region_view_name_highlight_event), region_view_name_highlight, this));
|
name_highlight->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
|
||||||
fade_in_shape->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_fade_in_event), fade_in_shape, this));
|
fade_in_shape->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_event), fade_in_shape, this));
|
||||||
|
fade_in_handle->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_handle_event), fade_in_handle, this));
|
||||||
fade_in_handle->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_fade_in_handle_event), fade_in_handle, this));
|
fade_out_shape->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_event), fade_out_shape, this));
|
||||||
fade_out_shape->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_fade_out_event), fade_out_shape, this));
|
fade_out_handle->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_handle_event), fade_out_handle, this));
|
||||||
fade_out_handle->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_fade_out_handle_event), fade_out_handle, this));
|
|
||||||
|
|
||||||
set_colors ();
|
set_colors ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ RouteParams_UI::cleanup_pre_view (bool stopupdate)
|
||||||
PluginUI * plugui = 0;
|
PluginUI * plugui = 0;
|
||||||
|
|
||||||
if (stopupdate && (plugui = dynamic_cast<PluginUI*>(_active_pre_view)) != 0) {
|
if (stopupdate && (plugui = dynamic_cast<PluginUI*>(_active_pre_view)) != 0) {
|
||||||
plugui->stop_updating ();
|
plugui->stop_updating (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_pre_plugin_conn.disconnect();
|
_pre_plugin_conn.disconnect();
|
||||||
|
|
@ -311,7 +311,7 @@ RouteParams_UI::cleanup_post_view (bool stopupdate)
|
||||||
PluginUI * plugui = 0;
|
PluginUI * plugui = 0;
|
||||||
|
|
||||||
if (stopupdate && (plugui = dynamic_cast<PluginUI*>(_active_post_view)) != 0) {
|
if (stopupdate && (plugui = dynamic_cast<PluginUI*>(_active_post_view)) != 0) {
|
||||||
plugui->stop_updating ();
|
plugui->stop_updating (0);
|
||||||
}
|
}
|
||||||
_post_plugin_conn.disconnect();
|
_post_plugin_conn.disconnect();
|
||||||
post_redir_hpane.remove(*_active_post_view);
|
post_redir_hpane.remove(*_active_post_view);
|
||||||
|
|
@ -573,7 +573,7 @@ RouteParams_UI::redirect_selected (ARDOUR::Redirect *redirect, ARDOUR::Placement
|
||||||
if (place == PreFader) {
|
if (place == PreFader) {
|
||||||
cleanup_pre_view();
|
cleanup_pre_view();
|
||||||
_pre_plugin_conn = plugin_insert->plugin().GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), PreFader));
|
_pre_plugin_conn = plugin_insert->plugin().GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), PreFader));
|
||||||
plugin_ui->start_updating ();
|
plugin_ui->start_updating (0);
|
||||||
_active_pre_view = plugin_ui;
|
_active_pre_view = plugin_ui;
|
||||||
pre_redir_hpane.add2 (*_active_pre_view);
|
pre_redir_hpane.add2 (*_active_pre_view);
|
||||||
pre_redir_hpane.show_all();
|
pre_redir_hpane.show_all();
|
||||||
|
|
@ -581,7 +581,7 @@ RouteParams_UI::redirect_selected (ARDOUR::Redirect *redirect, ARDOUR::Placement
|
||||||
else {
|
else {
|
||||||
cleanup_post_view();
|
cleanup_post_view();
|
||||||
_post_plugin_conn = plugin_insert->plugin().GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), PostFader));
|
_post_plugin_conn = plugin_insert->plugin().GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), PostFader));
|
||||||
plugin_ui->start_updating ();
|
plugin_ui->start_updating (0);
|
||||||
_active_post_view = plugin_ui;
|
_active_post_view = plugin_ui;
|
||||||
post_redir_hpane.add2 (*_active_post_view);
|
post_redir_hpane.add2 (*_active_post_view);
|
||||||
post_redir_hpane.show_all();
|
post_redir_hpane.show_all();
|
||||||
|
|
|
||||||
|
|
@ -567,10 +567,9 @@ RouteUI::choose_color()
|
||||||
Gdk::Color color;
|
Gdk::Color color;
|
||||||
Gdk::Color current;
|
Gdk::Color current;
|
||||||
|
|
||||||
current.set_red ( _color.get_red() / 65535.0);
|
current.set_red ( _color.get_red() / 65535);
|
||||||
current.set_green (_color.get_green() / 65535.0);
|
current.set_green (_color.get_green() / 65535);
|
||||||
current.set_blue (_color.get_blue() / 65535.0);
|
current.set_blue (_color.get_blue() / 65535);
|
||||||
//current[3] = 1.0;
|
|
||||||
|
|
||||||
color = Gtkmm2ext::UI::instance()->get_color (_("ardour: color selection"), picked, ¤t);
|
color = Gtkmm2ext::UI::instance()->get_color (_("ardour: color selection"), picked, ¤t);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ StreamView::StreamView (AudioTimeAxisView& tv)
|
||||||
canvas_rect->set_property ("outline_what", (guint32) (0x1|0x2|0x8));
|
canvas_rect->set_property ("outline_what", (guint32) (0x1|0x2|0x8));
|
||||||
canvas_rect->set_property ("fill_color_rgba", stream_base_color);
|
canvas_rect->set_property ("fill_color_rgba", stream_base_color);
|
||||||
|
|
||||||
canvas_rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_stream_view_event), canvas_rect, this));
|
canvas_rect->signal_event().connect (bind (mem_fun (_trackview.editor, &PublicEditor::canvas_stream_view_event), canvas_rect, &_trackview));
|
||||||
|
|
||||||
_samples_per_unit = _trackview.editor.get_current_zoom();
|
_samples_per_unit = _trackview.editor.get_current_zoom();
|
||||||
_amplitude_above_axis = 1.0;
|
_amplitude_above_axis = 1.0;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "time_axis_view.h"
|
#include "time_axis_view.h"
|
||||||
#include "simplerect.h"
|
#include "simplerect.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "canvas_impl.h"
|
||||||
#include "rgb_macros.h"
|
#include "rgb_macros.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include <gtkmm2ext/utils.h>
|
#include <gtkmm2ext/utils.h>
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
|
#include "keyboard.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
#include "rgb_macros.h"
|
#include "rgb_macros.h"
|
||||||
|
|
@ -315,9 +316,9 @@ get_canvas_points (string who, uint32_t npoints)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
channel_combo_get_channel_count (Gtk::Combo& combo)
|
channel_combo_get_channel_count (Gtk::ComboBoxText& combo)
|
||||||
{
|
{
|
||||||
string str = combo.get_entry()->get_text();
|
string str = combo.get_active_text();
|
||||||
int chns;
|
int chns;
|
||||||
|
|
||||||
if (str == _("mono")) {
|
if (str == _("mono")) {
|
||||||
|
|
@ -501,8 +502,3 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a)
|
||||||
return (uint32_t) RGBA_TO_UINT(r,g,b,a);
|
return (uint32_t) RGBA_TO_UINT(r,g,b,a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
decorate (Gtk::Window& w, Gdk::WMDecoration d)
|
|
||||||
{
|
|
||||||
w.get_window()->set_decorations (d);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ GType WaveView::get_base_type()
|
||||||
return gnome_canvas_waveview_get_type();
|
return gnome_canvas_waveview_get_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
GnomeCanvasWaveViewCache*
|
||||||
WaveView::create_cache ()
|
WaveView::create_cache ()
|
||||||
{
|
{
|
||||||
return gnome_canvas_waveview_cache_new ();
|
return gnome_canvas_waveview_cache_new ();
|
||||||
|
|
@ -140,13 +140,13 @@ Glib::PropertyProxy_ReadOnly<void*> WaveView::property_data_src() const
|
||||||
{
|
{
|
||||||
return Glib::PropertyProxy_ReadOnly<void*> (this, "data-src");
|
return Glib::PropertyProxy_ReadOnly<void*> (this, "data-src");
|
||||||
}
|
}
|
||||||
Glib::PropertyProxy<uint32_t*> WaveView::property_channel()
|
Glib::PropertyProxy<uint32_t> WaveView::property_channel()
|
||||||
{
|
{
|
||||||
return Glib::PropertyProxy<void*> (this, "channel");
|
return Glib::PropertyProxy<uint32_t> (this, "channel");
|
||||||
}
|
}
|
||||||
Glib::PropertyProxy_ReadOnly<uint32_t*> WaveView::property_channel() const
|
Glib::PropertyProxy_ReadOnly<uint32_t> WaveView::property_channel() const
|
||||||
{
|
{
|
||||||
return Glib::PropertyProxy_ReadOnly<void*> (this, "channel");
|
return Glib::PropertyProxy_ReadOnly<uint32_t> (this, "channel");
|
||||||
}
|
}
|
||||||
Glib::PropertyProxy<void*> WaveView::property_length_function()
|
Glib::PropertyProxy<void*> WaveView::property_length_function()
|
||||||
{
|
{
|
||||||
|
|
@ -198,11 +198,11 @@ Glib::PropertyProxy_ReadOnly<void*> WaveView::property_cache() const
|
||||||
}
|
}
|
||||||
Glib::PropertyProxy<bool> WaveView::property_cache_updater()
|
Glib::PropertyProxy<bool> WaveView::property_cache_updater()
|
||||||
{
|
{
|
||||||
return Glib::PropertyProxy<void*> (this, "cache-updater");
|
return Glib::PropertyProxy<bool> (this, "cache-updater");
|
||||||
}
|
}
|
||||||
Glib::PropertyProxy_ReadOnly<bool> WaveView::property_cache_updater() const
|
Glib::PropertyProxy_ReadOnly<bool> WaveView::property_cache_updater() const
|
||||||
{
|
{
|
||||||
return Glib::PropertyProxy_ReadOnly<void*> (this, "cache-updater");
|
return Glib::PropertyProxy_ReadOnly<bool> (this, "cache-updater");
|
||||||
}
|
}
|
||||||
Glib::PropertyProxy<double> WaveView::property_samples_per_unit()
|
Glib::PropertyProxy<double> WaveView::property_samples_per_unit()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ private:
|
||||||
public:
|
public:
|
||||||
WaveView(Group& parent);
|
WaveView(Group& parent);
|
||||||
|
|
||||||
static void* create_cache();
|
static GnomeCanvasWaveViewCache* create_cache();
|
||||||
|
|
||||||
Glib::PropertyProxy<void*> property_data_src();
|
Glib::PropertyProxy<void*> property_data_src();
|
||||||
Glib::PropertyProxy_ReadOnly<void*> property_data_src() const;
|
Glib::PropertyProxy_ReadOnly<void*> property_data_src() const;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ controller.cc
|
||||||
dndtreeview.cc
|
dndtreeview.cc
|
||||||
fastmeter.cc
|
fastmeter.cc
|
||||||
gtk_ui.cc
|
gtk_ui.cc
|
||||||
gtkutils.cc
|
|
||||||
hexentry.cc
|
hexentry.cc
|
||||||
idle_adjustment.cc
|
idle_adjustment.cc
|
||||||
pix.cc
|
pix.cc
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,7 @@ void
|
||||||
Choice::on_realize ()
|
Choice::on_realize ()
|
||||||
{
|
{
|
||||||
Gtk::Window::on_realize();
|
Gtk::Window::on_realize();
|
||||||
Glib::RefPtr<Gdk::Window> win (get_window());
|
get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
||||||
win->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Choice::~Choice ()
|
Choice::~Choice ()
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ using namespace Gtk;
|
||||||
using namespace Gtkmm2ext;
|
using namespace Gtkmm2ext;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Pixmap> *FastMeter::v_pixmap = 0;
|
Glib::RefPtr<Gdk::Pixmap> FastMeter::v_pixmap;
|
||||||
Glib::RefPtr<Gdk::Bitmap> *FastMeter::v_mask = 0;
|
Glib::RefPtr<Gdk::Bitmap> FastMeter::v_mask;
|
||||||
gint FastMeter::v_pixheight = 0;
|
gint FastMeter::v_pixheight = 0;
|
||||||
gint FastMeter::v_pixwidth = 0;
|
gint FastMeter::v_pixwidth = 0;
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Pixmap> *FastMeter::h_pixmap = 0;
|
Glib::RefPtr<Gdk::Pixmap> FastMeter::h_pixmap;
|
||||||
Glib::RefPtr<Gdk::Bitmap> *FastMeter::h_mask = 0;
|
Glib::RefPtr<Gdk::Bitmap> FastMeter::h_mask;
|
||||||
gint FastMeter::h_pixheight = 0;
|
gint FastMeter::h_pixheight = 0;
|
||||||
gint FastMeter::h_pixwidth = 0;
|
gint FastMeter::h_pixwidth = 0;
|
||||||
|
|
||||||
|
|
@ -63,15 +63,10 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o)
|
||||||
|
|
||||||
request_width = pixrect.get_width();
|
request_width = pixrect.get_width();
|
||||||
request_height= pixrect.get_height();
|
request_height= pixrect.get_height();
|
||||||
|
|
||||||
backing = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FastMeter::~FastMeter ()
|
FastMeter::~FastMeter ()
|
||||||
{
|
{
|
||||||
if (backing) {
|
|
||||||
(*backing)->unreference();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -79,10 +74,9 @@ FastMeter::set_vertical_xpm (const char **xpm)
|
||||||
{
|
{
|
||||||
if (v_pixmap == 0) {
|
if (v_pixmap == 0) {
|
||||||
gint w, h;
|
gint w, h;
|
||||||
|
|
||||||
*v_pixmap = Gdk::Pixmap::create_from_xpm(Gdk::Colormap::get_system(), *v_mask, xpm);
|
|
||||||
|
|
||||||
(*v_pixmap)->get_size(w, h);
|
v_pixmap = Gdk::Pixmap::create_from_xpm(Gdk::Colormap::get_system(), v_mask, xpm);
|
||||||
|
v_pixmap->get_size(w, h);
|
||||||
|
|
||||||
v_pixheight = h;
|
v_pixheight = h;
|
||||||
v_pixwidth = w;
|
v_pixwidth = w;
|
||||||
|
|
@ -95,9 +89,8 @@ FastMeter::set_horizontal_xpm (const char **xpm)
|
||||||
if (h_pixmap == 0) {
|
if (h_pixmap == 0) {
|
||||||
gint w, h;
|
gint w, h;
|
||||||
|
|
||||||
*h_pixmap = Gdk::Pixmap::create_from_xpm(Gdk::Colormap::get_system(), *h_mask, xpm);
|
h_pixmap = Gdk::Pixmap::create_from_xpm(Gdk::Colormap::get_system(), h_mask, xpm);
|
||||||
|
h_pixmap->get_size(w, h);
|
||||||
(*h_pixmap)->get_size(w, h);
|
|
||||||
|
|
||||||
h_pixheight = h;
|
h_pixheight = h;
|
||||||
h_pixwidth = w;
|
h_pixwidth = w;
|
||||||
|
|
@ -147,14 +140,14 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
|
||||||
pixrect.set_height(v_pixheight - top_of_meter); /* bottom of background */
|
pixrect.set_height(v_pixheight - top_of_meter); /* bottom of background */
|
||||||
|
|
||||||
if (backing == 0) {
|
if (backing == 0) {
|
||||||
*backing = Gdk::Pixmap::create (get_window(), get_width(), get_height());
|
backing = Gdk::Pixmap::create (get_window(), get_width(), get_height());
|
||||||
}
|
}
|
||||||
|
|
||||||
intersect = pixrect.intersect(Glib::wrap(&ev->area), intersecting);
|
intersect = pixrect.intersect(Glib::wrap(&ev->area), intersecting);
|
||||||
if (intersecting) {
|
if (intersecting) {
|
||||||
|
|
||||||
/* paint the background (black). */
|
/* paint the background (black). */
|
||||||
(*backing)->draw_rectangle(get_style()->get_black_gc(), true, intersect.get_x(), intersect.get_y(), intersect.get_width(), intersect.get_height());
|
backing->draw_rectangle(get_style()->get_black_gc(), true, intersect.get_x(), intersect.get_y(), intersect.get_width(), intersect.get_height());
|
||||||
blit = true;
|
blit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,10 +158,10 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
|
||||||
/* draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
|
/* draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(*backing)->draw_drawable(get_style()->get_fg_gc(get_state()), *v_pixmap,
|
backing->draw_drawable(get_style()->get_fg_gc(get_state()), v_pixmap,
|
||||||
intersect.get_x(), v_pixheight - top_of_meter,
|
intersect.get_x(), v_pixheight - top_of_meter,
|
||||||
intersect.get_x(), v_pixheight - top_of_meter,
|
intersect.get_x(), v_pixheight - top_of_meter,
|
||||||
intersect.get_width(), intersect.get_height());
|
intersect.get_width(), intersect.get_height());
|
||||||
|
|
||||||
blit = true;
|
blit = true;
|
||||||
}
|
}
|
||||||
|
|
@ -176,20 +169,20 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
|
||||||
/* draw peak bar */
|
/* draw peak bar */
|
||||||
|
|
||||||
if (hold_state) {
|
if (hold_state) {
|
||||||
(*backing)->draw_drawable(get_style()->get_fg_gc(get_state()), *v_pixmap,
|
backing->draw_drawable(get_style()->get_fg_gc(get_state()), v_pixmap,
|
||||||
intersect.get_x(), v_pixheight - (gint) floor (v_pixheight * current_peak),
|
intersect.get_x(), v_pixheight - (gint) floor (v_pixheight * current_peak),
|
||||||
intersect.get_x(), v_pixheight - (gint) floor (v_pixheight * current_peak),
|
intersect.get_x(), v_pixheight - (gint) floor (v_pixheight * current_peak),
|
||||||
intersect.get_width(), 3);
|
intersect.get_width(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bilt to on-screen drawable */
|
/* bilt to on-screen drawable */
|
||||||
|
|
||||||
if (blit) {
|
if (blit) {
|
||||||
Glib::RefPtr<Gdk::Window> win (get_window());
|
Glib::RefPtr<Gdk::Window> win (get_window());
|
||||||
win->draw_drawable(get_style()->get_fg_gc(get_state()), *backing,
|
win->draw_drawable(get_style()->get_fg_gc(get_state()), backing,
|
||||||
ev->area.x, ev->area.y,
|
ev->area.x, ev->area.y,
|
||||||
ev->area.x, ev->area.y,
|
ev->area.x, ev->area.y,
|
||||||
ev->area.width, ev->area.height);
|
ev->area.width, ev->area.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -210,14 +203,14 @@ FastMeter::horizontal_expose (GdkEventExpose* ev)
|
||||||
pixrect.set_width(h_pixwidth - right_of_meter);
|
pixrect.set_width(h_pixwidth - right_of_meter);
|
||||||
|
|
||||||
if (backing == 0) {
|
if (backing == 0) {
|
||||||
*backing = Gdk::Pixmap::create(get_window(), get_width(), get_height());
|
backing = Gdk::Pixmap::create(get_window(), get_width(), get_height());
|
||||||
}
|
}
|
||||||
|
|
||||||
intersect = pixrect.intersect(Glib::wrap(&ev->area), intersecting);
|
intersect = pixrect.intersect(Glib::wrap(&ev->area), intersecting);
|
||||||
if (intersecting) {
|
if (intersecting) {
|
||||||
/* paint the background (black). */
|
/* paint the background (black). */
|
||||||
|
|
||||||
(*backing)->draw_rectangle(get_style()->get_black_gc(), true,
|
backing->draw_rectangle(get_style()->get_black_gc(), true,
|
||||||
intersect.get_x(), intersect.get_y(),
|
intersect.get_x(), intersect.get_y(),
|
||||||
intersect.get_width(), intersect.get_height());
|
intersect.get_width(), intersect.get_height());
|
||||||
blit = true;
|
blit = true;
|
||||||
|
|
@ -231,10 +224,10 @@ FastMeter::horizontal_expose (GdkEventExpose* ev)
|
||||||
/* draw the part of the meter image that we need.
|
/* draw the part of the meter image that we need.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(*backing)->draw_drawable(get_style()->get_fg_gc(get_state()), *h_pixmap,
|
backing->draw_drawable(get_style()->get_fg_gc(get_state()), h_pixmap,
|
||||||
intersect.get_x(), intersect.get_y(),
|
intersect.get_x(), intersect.get_y(),
|
||||||
intersect.get_x(), intersect.get_y(),
|
intersect.get_x(), intersect.get_y(),
|
||||||
intersect.get_width(), intersect.get_height());
|
intersect.get_width(), intersect.get_height());
|
||||||
|
|
||||||
blit = true;
|
blit = true;
|
||||||
}
|
}
|
||||||
|
|
@ -242,17 +235,17 @@ FastMeter::horizontal_expose (GdkEventExpose* ev)
|
||||||
/* draw peak bar */
|
/* draw peak bar */
|
||||||
|
|
||||||
if (hold_state) {
|
if (hold_state) {
|
||||||
(*backing)->draw_drawable(get_style()->get_fg_gc(get_state()), *h_pixmap,
|
backing->draw_drawable(get_style()->get_fg_gc(get_state()), h_pixmap,
|
||||||
right_of_meter, intersect.get_y(),
|
right_of_meter, intersect.get_y(),
|
||||||
right_of_meter, intersect.get_y(),
|
right_of_meter, intersect.get_y(),
|
||||||
3, intersect.get_height());
|
3, intersect.get_height());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bilt to on-screen drawable */
|
/* bilt to on-screen drawable */
|
||||||
|
|
||||||
if (blit) {
|
if (blit) {
|
||||||
Glib::RefPtr<Gdk::Window> win(get_window());
|
Glib::RefPtr<Gdk::Window> win(get_window());
|
||||||
win->draw_drawable(get_style()->get_fg_gc(get_state()), *backing,
|
win->draw_drawable(get_style()->get_fg_gc(get_state()), backing,
|
||||||
ev->area.x, ev->area.y,
|
ev->area.x, ev->area.y,
|
||||||
ev->area.x, ev->area.y,
|
ev->area.x, ev->area.y,
|
||||||
ev->area.width, ev->area.height);
|
ev->area.width, ev->area.height);
|
||||||
|
|
|
||||||
|
|
@ -85,11 +85,6 @@ UI::UI (string name, int *argc, char ***argv, string rcfile)
|
||||||
errors->set_title (title);
|
errors->set_title (title);
|
||||||
|
|
||||||
errors->dismiss_button().set_name ("ErrorLogCloseButton");
|
errors->dismiss_button().set_name ("ErrorLogCloseButton");
|
||||||
// errors->realize();
|
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Window> win(errors->get_window());
|
|
||||||
win->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
|
||||||
|
|
||||||
errors->signal_delete_event().connect (bind (ptr_fun (just_hide_it), (Gtk::Window *) errors));
|
errors->signal_delete_event().connect (bind (ptr_fun (just_hide_it), (Gtk::Window *) errors));
|
||||||
|
|
||||||
register_thread (pthread_self(), X_("GUI"));
|
register_thread (pthread_self(), X_("GUI"));
|
||||||
|
|
|
||||||
|
|
@ -54,18 +54,18 @@ class FastMeter : public Gtk::DrawingArea {
|
||||||
void on_size_request (GtkRequisition*);
|
void on_size_request (GtkRequisition*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Glib::RefPtr<Gdk::Pixmap>* h_pixmap;
|
static Glib::RefPtr<Gdk::Pixmap> h_pixmap;
|
||||||
static Glib::RefPtr<Gdk::Bitmap>* h_mask;
|
static Glib::RefPtr<Gdk::Bitmap> h_mask;
|
||||||
static gint h_pixheight;
|
static gint h_pixheight;
|
||||||
static gint h_pixwidth;
|
static gint h_pixwidth;
|
||||||
|
|
||||||
static Glib::RefPtr<Gdk::Pixmap>* v_pixmap;
|
static Glib::RefPtr<Gdk::Pixmap> v_pixmap;
|
||||||
static Glib::RefPtr<Gdk::Bitmap>* v_mask;
|
static Glib::RefPtr<Gdk::Bitmap> v_mask;
|
||||||
static gint v_pixheight;
|
static gint v_pixheight;
|
||||||
static gint v_pixwidth;
|
static gint v_pixwidth;
|
||||||
|
|
||||||
Orientation orientation;
|
Orientation orientation;
|
||||||
Glib::RefPtr<Gdk::Pixmap>* backing;
|
Glib::RefPtr<Gdk::Pixmap> backing;
|
||||||
Gdk::Rectangle pixrect;
|
Gdk::Rectangle pixrect;
|
||||||
gint request_width;
|
gint request_width;
|
||||||
gint request_height;
|
gint request_height;
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,12 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
void set_usize_to_display_given_text (Gtk::Widget& w,
|
namespace Gtk {
|
||||||
const std::string& text,
|
class Widget;
|
||||||
gint hpadding = 0,
|
}
|
||||||
gint vpadding = 0);
|
|
||||||
|
void gtk_set_size_request_to_display_given_text (Gtk::Widget& w,
|
||||||
|
const std::string& text,
|
||||||
|
gint hpadding = 0,
|
||||||
|
gint vpadding = 0);
|
||||||
#endif /* __gtkutils_h__ */
|
#endif /* __gtkutils_h__ */
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ class PopUp : public Gtk::Window, public Touchable
|
||||||
|
|
||||||
bool on_delete_event (GdkEventAny* );
|
bool on_delete_event (GdkEventAny* );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void on_realize ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gtk::Label label;
|
Gtk::Label label;
|
||||||
std::string my_text;
|
std::string my_text;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class TearOff : public Gtk::HBox
|
||||||
Gtk::Window* tearoff_window() const { return own_window; }
|
Gtk::Window* tearoff_window() const { return own_window; }
|
||||||
bool torn_off() const;
|
bool torn_off() const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gtk::Widget& contents;
|
Gtk::Widget& contents;
|
||||||
Gtk::Window* own_window;
|
Gtk::Window* own_window;
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,15 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <gtkmm/widget.h>
|
|
||||||
#include <gtkmm/paned.h>
|
#include <gdkmm/window.h> /* for WMDecoration */
|
||||||
#include <gtkmm/comboboxtext.h>
|
|
||||||
|
namespace Gtk {
|
||||||
|
class ComboBoxText;
|
||||||
|
class Widget;
|
||||||
|
class Window;
|
||||||
|
class Paned;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Gtkmm2ext {
|
namespace Gtkmm2ext {
|
||||||
void init ();
|
void init ();
|
||||||
|
|
@ -42,6 +48,7 @@ namespace Gtkmm2ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkWindow* get_paned_handle (Gtk::Paned& paned);
|
GdkWindow* get_paned_handle (Gtk::Paned& paned);
|
||||||
|
void set_decoration (Gtk::Window* win, Gdk::WMDecoration decor);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __gtkmm2ext_utils_h__ */
|
#endif /* __gtkmm2ext_utils_h__ */
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,10 @@
|
||||||
#include <gtkmm2ext/gtkutils.h>
|
#include <gtkmm2ext/gtkutils.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
set_size_request_to_display_given_text (Gtk::Widget &w,
|
gtk_set_size_request_to_display_given_text (Gtk::Widget &w,
|
||||||
const std::string& text,
|
const std::string& text,
|
||||||
gint hpadding,
|
gint hpadding,
|
||||||
gint vpadding)
|
gint vpadding)
|
||||||
{
|
{
|
||||||
int height = 0;
|
|
||||||
int width = 0;
|
|
||||||
|
|
||||||
w.create_pango_layout(text)->get_pixel_size(width, height);
|
|
||||||
|
|
||||||
height += vpadding;
|
|
||||||
width += hpadding;
|
|
||||||
|
|
||||||
w.set_size_request(width, height);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,6 @@ PopUp::PopUp (Gtk::WindowPosition pos, unsigned int showfor_msecs, bool doh)
|
||||||
: Window (WINDOW_POPUP)
|
: Window (WINDOW_POPUP)
|
||||||
{
|
{
|
||||||
|
|
||||||
realize ();
|
|
||||||
Glib::RefPtr<Gdk::Window> win (get_window());
|
|
||||||
win->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
|
||||||
add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
||||||
signal_button_press_event().connect(mem_fun(*this,&PopUp::button_click));
|
signal_button_press_event().connect(mem_fun(*this,&PopUp::button_click));
|
||||||
set_border_width (12);
|
set_border_width (12);
|
||||||
|
|
@ -50,6 +47,13 @@ PopUp::~PopUp ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PopUp::on_realize ()
|
||||||
|
{
|
||||||
|
Gtk::Window::on_realize();
|
||||||
|
get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
PopUp::remove_prompt_timeout (void *arg)
|
PopUp::remove_prompt_timeout (void *arg)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <gtkmm2ext/tearoff.h>
|
#include <gtkmm2ext/tearoff.h>
|
||||||
|
#include <gtkmm2ext/utils.h>
|
||||||
|
|
||||||
using namespace Gtkmm2ext;
|
using namespace Gtkmm2ext;
|
||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
|
|
@ -43,10 +44,6 @@ TearOff::TearOff (Gtk::Widget& c)
|
||||||
own_window = new Gtk::Window (Gtk::WINDOW_TOPLEVEL);
|
own_window = new Gtk::Window (Gtk::WINDOW_TOPLEVEL);
|
||||||
own_window->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::POINTER_MOTION_HINT_MASK);
|
own_window->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::POINTER_MOTION_HINT_MASK);
|
||||||
own_window->set_resizable (false);
|
own_window->set_resizable (false);
|
||||||
// own_window->realize ();
|
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Window> win (own_window->get_window());
|
|
||||||
win->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
|
||||||
|
|
||||||
VBox* box1;
|
VBox* box1;
|
||||||
box1 = manage (new VBox);
|
box1 = manage (new VBox);
|
||||||
|
|
@ -59,7 +56,8 @@ TearOff::TearOff (Gtk::Widget& c)
|
||||||
own_window->signal_button_release_event().connect (mem_fun (*this, &TearOff::window_button_release));
|
own_window->signal_button_release_event().connect (mem_fun (*this, &TearOff::window_button_release));
|
||||||
own_window->signal_motion_notify_event().connect (mem_fun (*this, &TearOff::window_motion));
|
own_window->signal_motion_notify_event().connect (mem_fun (*this, &TearOff::window_motion));
|
||||||
own_window->signal_delete_event().connect (mem_fun (*this, &TearOff::window_delete_event));
|
own_window->signal_delete_event().connect (mem_fun (*this, &TearOff::window_delete_event));
|
||||||
|
own_window->signal_realize().connect (bind (sigc::ptr_fun (Gtkmm2ext::set_decoration), own_window, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
|
||||||
|
|
||||||
tearoff_arrow.set_name ("TearOffArrow");
|
tearoff_arrow.set_name ("TearOffArrow");
|
||||||
close_arrow.set_name ("TearOffArrow");
|
close_arrow.set_name ("TearOffArrow");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,9 @@
|
||||||
|
|
||||||
#include <gtk/gtkpaned.h>
|
#include <gtk/gtkpaned.h>
|
||||||
#include <gtkmm2ext/utils.h>
|
#include <gtkmm2ext/utils.h>
|
||||||
#include <gtkmm2ext/gtkutils.h>
|
#include <gtkmm/widget.h>
|
||||||
|
#include <gtkmm/window.h>
|
||||||
|
#include <gtkmm/paned.h>
|
||||||
#include <gtkmm/comboboxtext.h>
|
#include <gtkmm/comboboxtext.h>
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
@ -29,11 +31,19 @@ using namespace std;
|
||||||
|
|
||||||
void
|
void
|
||||||
Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *text,
|
Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *text,
|
||||||
gint hpadding, gint vpadding)
|
gint hpadding, gint vpadding)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
int height = 0;
|
||||||
|
int width = 0;
|
||||||
|
|
||||||
w.ensure_style ();
|
w.ensure_style ();
|
||||||
set_size_request_to_display_given_text(w, text, hpadding, vpadding);
|
w.create_pango_layout(text)->get_pixel_size (width, height);
|
||||||
|
|
||||||
|
height += vpadding;
|
||||||
|
width += hpadding;
|
||||||
|
|
||||||
|
w.set_size_request(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -58,3 +68,9 @@ Gtkmm2ext::get_paned_handle (Gtk::Paned& paned)
|
||||||
{
|
{
|
||||||
return GTK_PANED(paned.gobj())->handle;
|
return GTK_PANED(paned.gobj())->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Gtkmm2ext::set_decoration (Gtk::Window* win, Gdk::WMDecoration decor)
|
||||||
|
{
|
||||||
|
win->get_window()->set_decorations (decor);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue