--- gigedit/trunk/src/gigedit/dimregionchooser.h 2007/07/05 17:12:20 1261 +++ gigedit/trunk/src/gigedit/dimregionchooser.h 2017/01/02 22:13:01 3068 @@ -1,5 +1,5 @@ /* -*- c++ -*- - * Copyright (C) 2006, 2007 Andreas Persson + * Copyright (C) 2006-2017 Andreas Persson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -21,52 +21,77 @@ #define GIGEDIT_DIMREGIONCHOOSER_H #include -#include +#include +#include #include -#include +#include "compat.h" + +#ifdef LIBGIG_HEADER_FILE +# include LIBGIG_HEADER_FILE(gig.h) +#else +# include +#endif + +#include +#include class DimRegionChooser : public Gtk::DrawingArea { public: - DimRegionChooser(); + DimRegionChooser(Gtk::Window& window); virtual ~DimRegionChooser(); - void set_fromto(int from, int to); - void set_region(gig::Region* region); - sigc::signal signal_dimregion_selected(); - sigc::signal signal_region_changed(); + sigc::signal& signal_dimregion_selected(); + sigc::signal& signal_region_changed(); - gig::DimensionRegion* get_dimregion() { return dimreg; } + gig::DimensionRegion* get_main_dimregion() const; + void get_dimregions(const gig::Region* region, bool stereo, + std::set& dimregs) const; + bool select_dimregion(gig::DimensionRegion* dimrgn); protected: - virtual void on_realize(); +#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 virtual bool on_expose_event(GdkEventExpose* e); - virtual void on_size_request(GtkRequisition* requisition); +#else + virtual bool on_draw(const Cairo::RefPtr& cr); +#endif virtual bool on_button_press_event(GdkEventButton* event); virtual bool on_button_release_event(GdkEventButton* event); virtual bool on_motion_notify_event(GdkEventMotion* event); virtual bool on_focus(Gtk::DirectionType direction); + bool onKeyPressed(GdkEventKey* key); + bool onKeyReleased(GdkEventKey* key); + void refresh_all(); + void split_dimension_zone(); + void delete_dimension_zone(); + void resetSelectedZones(); - Glib::RefPtr gc; - Gdk::Color blue, red, black, white, green; + Gdk::RGBA red, black, white; gig::Instrument* instrument; gig::Region* region; - int dimregno; sigc::signal dimregion_selected; sigc::signal region_changed; - gig::DimensionRegion* dimreg; + //std::set dimregs; ///< Reflects which dimension regions are currently selected. int focus_line; - int dimvalue_from[256]; - int dimvalue_to[256]; + std::map > dimzones; ///< Reflects which zone(s) of the individual dimension are currently selected. int label_width; + bool labels_changed; int nbDimensions; + // the "main" dimension region is the one that is used to i.e. evaluate the + // precise custom velocity splits (could also be interpreted for focus stuff, + // i.e. keyboard arrow key navigation) + // NOTE: these may *not* necessarily currently be selected ! + gig::dimension_t maindimtype; + std::map maindimcase; + int maindimregno; + // information needed during a resize struct { bool active; @@ -82,11 +107,18 @@ int offset; } resize; + bool multiSelectKeyDown; + bool cursor_is_resize; bool is_in_resize_zone(double x, double y); + void update_after_resize(); int h; - int w; + + Glib::RefPtr actionGroup; + Glib::RefPtr uiManager; + Gtk::Menu* popup_menu_inside_dimregion; + Gtk::Menu* popup_menu_outside_dimregion; }; #endif