00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "gtkStatsPianoWindow.h"
00020 #include "gtkStatsPianoRoll.h"
00021
00022 using Gtk::Menu_Helpers::MenuElem;
00023 using Gtk::Menu_Helpers::SeparatorElem;
00024
00025
00026
00027
00028
00029
00030 GtkStatsPianoWindow::
00031 GtkStatsPianoWindow(GtkStatsMonitor *monitor, int thread_index,
00032 int chart_xsize, int chart_ysize) :
00033 GtkStatsWindow(monitor),
00034 _thread_index(thread_index)
00035 {
00036 setup_menu();
00037 layout_window(chart_xsize, chart_ysize);
00038 show();
00039 }
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 void GtkStatsPianoWindow::
00050 mark_dead() {
00051 GtkStatsWindow::mark_dead();
00052 _chart->mark_dead();
00053 }
00054
00055
00056
00057
00058
00059
00060 void GtkStatsPianoWindow::
00061 idle() {
00062 GtkStatsWindow::idle();
00063 _chart->update();
00064 }
00065
00066
00067
00068
00069
00070
00071 void GtkStatsPianoWindow::
00072 setup_menu() {
00073 GtkStatsWindow::setup_menu();
00074
00075 Gtk::Menu *scale_menu = new Gtk::Menu;
00076
00077 scale_menu->items().push_back
00078 (MenuElem("0.1 Hz",
00079 bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 0.1f)));
00080 scale_menu->items().push_back
00081 (MenuElem("1 Hz",
00082 bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 1.0f)));
00083 scale_menu->items().push_back
00084 (MenuElem("5 Hz",
00085 bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 5.0f)));
00086 scale_menu->items().push_back
00087 (MenuElem("10 Hz",
00088 bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 10.0f)));
00089 scale_menu->items().push_back
00090 (MenuElem("20 Hz",
00091 bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 20.0f)));
00092 scale_menu->items().push_back
00093 (MenuElem("30 Hz",
00094 bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 30.0f)));
00095 scale_menu->items().push_back
00096 (MenuElem("60 Hz",
00097 bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 60.0f)));
00098 scale_menu->items().push_back
00099 (MenuElem("120 Hz",
00100 bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 120.0f)));
00101
00102 _menu->items().push_back(MenuElem("Scale", *manage(scale_menu)));
00103 }
00104
00105
00106
00107
00108
00109
00110 void GtkStatsPianoWindow::
00111 menu_new_window() {
00112 new GtkStatsPianoWindow(_monitor, _thread_index,
00113 _chart->get_xsize(), _chart->get_ysize());
00114 }
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 void GtkStatsPianoWindow::
00125 menu_hscale(float hz) {
00126 _chart->set_horizontal_scale(1.0 / hz);
00127 }
00128
00129
00130
00131
00132
00133
00134 void GtkStatsPianoWindow::
00135 layout_window(int chart_xsize, int chart_ysize) {
00136 Gtk::HBox *hbox = new Gtk::HBox;
00137 hbox = new Gtk::HBox;
00138 hbox->show();
00139 _main_box->pack_start(*manage(hbox), true, true, 8);
00140
00141 Gtk::Table *chart_table = new Gtk::Table(1, 2);
00142 chart_table->show();
00143 hbox->pack_start(*manage(chart_table), true, true, 8);
00144
00145 Gtk::Frame *frame = new Gtk::Frame;
00146 frame->set_shadow_type(GTK_SHADOW_ETCHED_OUT);
00147 frame->show();
00148 chart_table->attach(*manage(frame), 1, 2, 0, 1);
00149
00150 _chart = new GtkStatsPianoRoll(_monitor, _thread_index,
00151 chart_xsize, chart_ysize);
00152 frame->add(*manage(_chart));
00153
00154
00155 Gtk::Frame *label_frame = new Gtk::Frame;
00156 label_frame->set_shadow_type(GTK_SHADOW_NONE);
00157 label_frame->show();
00158 label_frame->add(*manage(_chart->get_labels()));
00159
00160 chart_table->attach(*manage(label_frame), 0, 1, 0, 1,
00161 0, (GTK_FILL|GTK_EXPAND), 4, 0);
00162
00163 _chart->show();
00164 }