File: model_diagram_panel.h

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (130 lines) | stat: -rw-r--r-- 3,188 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//!
//! \addtogroup linuxui Linux UI
//! @{
//! 

#ifndef _MODEL_VIEW_PANEL_H_
#define _MODEL_VIEW_PANEL_H_

#include "linux_utilities/form_view_base.h"
#include <gtkmm/paned.h>
#include <gtkmm/box.h>
#include <gtkmm/notebook.h>
#include <gtkmm/builder.h>
#include "model/wb_model_diagram_form.h"
#include "gtk/mdc_gtk_canvas_view.h"
#include "gtk/mdc_gtk_canvas_scroller.h"
#include "mdc_canvas_view_x11.h"
#include "gtk/lf_view.h"

namespace Gtk
{
  class Entry;
};

namespace wb
{
  class WBContextUI;
};

class CatalogTree;
class PropertiesTree;
class DocumentationBox;
class NavigatorBox;
class InfoBox;


class ModelDiagramPanel : public Gtk::HPaned, public FormViewBase
{
  class InlineEditor : public wb::InlineEditContext
  {
    ModelDiagramPanel *_owner;
    Gtk::Entry *_edit_field;
    bool _editing;
    
    virtual void begin_editing(int x, int y, int width, int height, const std::string &text);
    virtual void end_editing();

    virtual void set_font_size(float size);
    virtual void set_multiline(bool flag);

  public:
    InlineEditor(ModelDiagramPanel *owner);
  };
  
  friend class InlineEditor;
 
  Gtk::VBox  _top_box;

  Gtk::VBox *_tools_toolbar;
  
  Gtk::Box *_vbox;
  Gtk::HBox *_diagram_hbox;

  wb::WBContextUI *_wb;
  wb::ModelDiagramForm *_be;
  mdc::GtkCanvasScroller _scroller;
  mdc::GtkCanvas *_canvas;
  Gdk::Cursor *_cursor;
  InlineEditor _inline_editor;
  Gtk::Paned *_editor_paned;
  Gtk::Widget *_sidebar;

  NavigatorBox                *_navigator_box;
  mforms::TreeNodeView        *_catalog_tree;
  mforms::TreeNodeView        *_usertypes_list;
  mforms::TreeNodeView        *_history_list;
  DocumentationBox            *_documentation_box;
  PropertiesTree              *_properties_tree;
  Glib::RefPtr<Gtk::Builder>   _xml;

  bool drag_drop(const Glib::RefPtr<Gdk::DragContext> &context, int x, int y, guint time);

  void drag_data_received(const Glib::RefPtr<Gdk::DragContext> &context, int x, int y,
                          const Gtk::SelectionData &selection_data,
                          guint, guint time);

  bool drag_motion(const Glib::RefPtr<Gdk::DragContext> &context, int x, int y, guint time);

  void view_realized();

  void post_construct(wb::WBContextUI *wb, Glib::RefPtr<Gtk::Builder> xml);

  sigc::connection    _sig_restore_sidebar;

public:
  static ModelDiagramPanel *create(wb::WBContextUI *wb);

  ModelDiagramPanel(GtkHPaned *paned, Glib::RefPtr<Gtk::Builder> xml);

  ~ModelDiagramPanel();

  void init(const std::string &view_id);
  virtual bec::UIForm *get_form() const { return _be; }
  virtual Gtk::Widget *get_panel() { return &_top_box; }
  virtual bool on_close();
  virtual void on_activate();
  
  wb::ModelDiagramForm *get_diagram_form() const { return _be; }
    
  mdc::CanvasView *get_canvas() const { return _canvas->get_canvas(); }
  
  void update_tool_cursor();

  void setup_navigator();
  void refresh_catalog(bool hard);
  void refresh_zoom();
  
  void selection_changed();

  virtual void find_text(const std::string &text);

  virtual void reset_layout() { _editor_paned->set_position(_editor_paned->get_height()-300); }
};


#endif /* _MODEL_VIEW_PANEL_H_ */

//!
//! @}
//!