add new profile object, use it to remove certain horizontal elements from GUI if screen is narrow; make verbose canvas cursor use primary clock mode if secondary clock is not visible

git-svn-id: svn://localhost/ardour2/trunk@1676 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-04-07 00:35:07 +00:00
parent 2dd0b9321c
commit c36c7f4b94
9 changed files with 70 additions and 10 deletions

View File

@ -16,7 +16,7 @@ import SCons.Node.FS
SConsignFile()
EnsureSConsVersion(0, 96)
ardour_version = '2.0beta12'
ardour_version = '2.0rc1'
subst_dict = { }

View File

@ -50,6 +50,7 @@
#include <midi++/mmc.h>
#include <ardour/ardour.h>
#include <ardour/profile.h>
#include <ardour/session_route.h>
#include <ardour/port.h>
#include <ardour/audioengine.h>
@ -642,11 +643,11 @@ ARDOUR_UI::update_sample_rate (nframes_t ignored)
nframes_t rate = engine->frame_rate();
if (fmod (rate, 1000.0) != 0.0) {
snprintf (buf, sizeof (buf), _("%.1f kHz / %4.1f msecs"),
snprintf (buf, sizeof (buf), _("%.1f kHz / %4.1f ms"),
(float) rate/1000.0f,
(engine->frames_per_cycle() / (float) rate) * 1000.0f);
} else {
snprintf (buf, sizeof (buf), _("%u kHz / %4.1f msecs"),
snprintf (buf, sizeof (buf), _("%u kHz / %4.1f ms"),
rate/1000,
(engine->frames_per_cycle() / (float) rate) * 1000.0f);
}
@ -2711,3 +2712,11 @@ ARDOUR_UI::TransportControllable::set_id (const string& str)
{
_id = str;
}
void
ARDOUR_UI::setup_profile ()
{
if (gdk_screen_width() < 1200) {
Profile->set_small_screen ();
}
}

View File

@ -212,6 +212,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void set_keybindings_path (std::string path);
void save_keybindings ();
void setup_profile ();
protected:
friend class PublicEditor;

View File

@ -34,6 +34,7 @@
#include <ardour/audioengine.h>
#include <ardour/ardour.h>
#include <ardour/profile.h>
#include <ardour/route.h>
#include "ardour_ui.h"
@ -364,7 +365,9 @@ ARDOUR_UI::setup_transport ()
HBox* clock_box = manage (new HBox);
clock_box->pack_start (primary_clock, false, false);
clock_box->pack_start (secondary_clock, false, false);
if (!ARDOUR::Profile->get_small_screen()) {
clock_box->pack_start (secondary_clock, false, false);
}
VBox* time_controls_box = manage (new VBox);
time_controls_box->pack_start (sync_option_combo, false, false);
time_controls_box->pack_start (time_master_button, false, false);

View File

@ -37,6 +37,7 @@
#include "actions.h"
#include <ardour/session.h>
#include <ardour/profile.h>
#include <ardour/audioengine.h>
#include <ardour/control_protocol_manager.h>
@ -698,11 +699,13 @@ ARDOUR_UI::build_menu_bar ()
sample_rate_label.set_name ("SampleRate");
menu_hbox.pack_start (*menu_bar, true, true);
menu_hbox.pack_end (wall_clock_box, false, false, 10);
menu_hbox.pack_end (disk_space_box, false, false, 10);
menu_hbox.pack_end (cpu_load_box, false, false, 10);
menu_hbox.pack_end (buffer_load_box, false, false, 10);
menu_hbox.pack_end (sample_rate_box, false, false, 10);
if (!Profile->get_small_screen()) {
menu_hbox.pack_end (wall_clock_box, false, false, 2);
menu_hbox.pack_end (disk_space_box, false, false, 4);
}
menu_hbox.pack_end (cpu_load_box, false, false, 4);
menu_hbox.pack_end (buffer_load_box, false, false, 4);
menu_hbox.pack_end (sample_rate_box, false, false, 4);
menu_bar_base.set_name ("MainMenuBar");
menu_bar_base.add (menu_hbox);

View File

@ -46,6 +46,7 @@
#include "rgb_macros.h"
#include <ardour/types.h>
#include <ardour/profile.h>
#include <ardour/route.h>
#include <ardour/audio_track.h>
#include <ardour/audio_diskstream.h>
@ -3307,6 +3308,12 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
where = (nframes_t) (unit_to_frame (ix1) * speed);
boost::shared_ptr<Region> new_region (RegionFactory::create (rv->region()));
/* undo the previous hide_dependent_views so that xfades don't
disappear on copying regions
*/
rv->get_time_axis_view().reveal_dependent_views (*rv);
if (!drag_info.copy) {
/* the region that used to be in the old playlist is not
@ -3510,7 +3517,7 @@ Editor::show_verbose_time_cursor (nframes_t frame, double offset, double xpos, d
return;
}
switch (ARDOUR_UI::instance()->secondary_clock.mode ()) {
switch (Profile->get_small_screen() ? ARDOUR_UI::instance()->primary_clock.mode () : ARDOUR_UI::instance()->secondary_clock.mode ()) {
case AudioClock::BBT:
session->bbt_time (frame, bbt);
snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);

View File

@ -273,6 +273,7 @@ int main (int argc, char *argv[])
ARDOUR::init (use_vst, try_hw_optimization);
setup_gtk_ardour_enums ();
Config->set_current_owner (ConfigVariableBase::Interface);
ui->setup_profile ();
try {
engine = new ARDOUR::AudioEngine (jack_client_name);

View File

@ -0,0 +1,31 @@
#ifndef __ardour_profile_h__
#define __ardour_profile_h__
#include <boost/dynamic_bitset.hpp>
#include <stdint.h>
namespace ARDOUR {
class RuntimeProfile {
public:
enum Element {
SmallScreen,
LastElement
};
RuntimeProfile() { bits.resize (LastElement); }
~RuntimeProfile() {}
void set_small_screen() { bits[SmallScreen] = true; }
bool get_small_screen() const { return bits[SmallScreen]; }
private:
boost::dynamic_bitset<uint64_t> bits;
};
extern RuntimeProfile* Profile;
}; // namespace ARDOUR
#endif /* __ardour_profile_h__ */

View File

@ -42,6 +42,7 @@
#include <ardour/ardour.h>
#include <ardour/audio_library.h>
#include <ardour/configuration.h>
#include <ardour/profile.h>
#include <ardour/plugin_manager.h>
#include <ardour/audiosource.h>
#include <ardour/utils.h>
@ -61,6 +62,7 @@
#include "i18n.h"
ARDOUR::Configuration* ARDOUR::Config = 0;
ARDOUR::RuntimeProfile* ARDOUR::Profile = 0;
ARDOUR::AudioLibrary* ARDOUR::Library = 0;
#ifdef HAVE_LIBLO
@ -294,6 +296,8 @@ ARDOUR::init (bool use_vst, bool try_optimization)
Config->set_use_vst (use_vst);
Profile = new RuntimeProfile;
if (setup_midi ()) {
return -1;
}