--- gigedit/trunk/src/gigedit/dimregionchooser.h 2014/05/16 23:19:23 2556 +++ gigedit/trunk/src/gigedit/dimregionchooser.h 2017/05/04 11:47:45 3148 @@ -1,5 +1,5 @@ /* -*- c++ -*- - * Copyright (C) 2006-2014 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 @@ -27,14 +27,21 @@ #include "compat.h" -#include +#ifdef LIBGIG_HEADER_FILE +# include LIBGIG_HEADER_FILE(gig.h) +#else +# include +#endif #include +#include + +#include "global.h" class DimRegionChooser : public Gtk::DrawingArea { public: - DimRegionChooser(); + DimRegionChooser(Gtk::Window& window); virtual ~DimRegionChooser(); void set_region(gig::Region* region); @@ -42,9 +49,20 @@ sigc::signal& signal_dimregion_selected(); sigc::signal& signal_region_changed(); - gig::DimensionRegion* get_dimregion() const { 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); + void select_next_dimzone(bool add = false); + void select_prev_dimzone(bool add = false); + void select_next_dimension(); + void select_prev_dimension(); + + // those 3 are ATM only relevant when resizing custom dimension region zones + // and for painting those auto selected zones with gray hatched pattern + void setModifyBothChannels(bool b); + void setModifyAllDimensionRegions(bool b); + void setModifyAllRegions(bool b); protected: #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 @@ -56,28 +74,45 @@ 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(); + void select_dimzone_by_dir(int dir, bool add = false); - Gdk::RGBA red, black, white; + Gdk::RGBA red, blue, black, white; + Glib::RefPtr blueHatchedPatternARGB; + Cairo::RefPtr blueHatchedSurfacePattern; + Glib::RefPtr grayBlueHatchedPatternARGB; + Cairo::RefPtr grayBlueHatchedSurfacePattern; gig::Instrument* instrument; gig::Region* region; - int dimregno; sigc::signal dimregion_selected; sigc::signal region_changed; - gig::DimensionRegion* dimreg; + // those 3 are ATM only relevant when resizing custom dimension region zones + // and for painting those auto selected zones with gray hatched pattern + bool modifybothchannels; + bool modifyalldimregs; + bool modifyallregions; + int focus_line; - int dimvalue[256]; + std::map > dimzones; ///< Reflects which zone(s) of the individual dimension are currently selected. int label_width; bool labels_changed; int nbDimensions; - int dimtype; - int dimzone; + // 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; + DimensionCase maindimcase; + int maindimregno; // information needed during a resize struct { @@ -91,9 +126,14 @@ int min; int max; int dimension; - int offset; + gig::dimension_def_t dimensionDef; + int zone; } resize; + bool multiSelectKeyDown; + bool primaryKeyDown; // on Mac: Cmd key, on all other OSs: Ctrl key + bool shiftKeyDown; + bool cursor_is_resize; bool is_in_resize_zone(double x, double y); void update_after_resize(); @@ -104,6 +144,10 @@ Glib::RefPtr uiManager; Gtk::Menu* popup_menu_inside_dimregion; Gtk::Menu* popup_menu_outside_dimregion; + +private: + Glib::RefPtr actionDeleteDimZone; + Glib::RefPtr actionSplitDimZone; }; #endif