Changeset 76 in projects
- Timestamp:
- Jul 26, 2013, 3:46:35 PM (11 years ago)
- Location:
- paper-tape-project/trunk/visualisator
- Files:
-
- 18 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
paper-tape-project/trunk/visualisator/Makefile
r73 r76 11 11 cli: cli.c lochstreifen.o 12 12 $(CC) $(CAIRO_CFLAGS) $^ $(CAIRO_LIBS) -lm -o $@ 13 14 15 #%.o: %.cc %.h 16 # $(CPP) $(CFLAGS) $(GTKMM_CFLAGS) -c $< 17 13 18 14 19 gtkpapertape.o: gtkpapertape.cc gtkpapertape.h … … 34 39 35 40 clean: 36 rm -f v*.o cli gtk41 rm -f *.o cli gtk -
paper-tape-project/trunk/visualisator/cli.c
r73 r76 250 250 long color_value[4]; // interpreted numbers 251 251 char buf[3] = "xy"; // Buffer for strtol <- one color value 252 252 253 253 // remove a "#" char if present 254 254 if(string[0] == '#') … … 260 260 // copy the current character to buffer, first position 261 261 buf[0] = string[x]; 262 263 262 // if short notation (shorter than AABBCC), dublicate 264 263 // current character to buffer second position, else … … 268 267 color_value[color] = strtol(buf, NULL, 16); 269 268 } 270 269 271 270 DPRINTF("Allocating '%s' as #%02x%02x%02x%02x\n", string, 272 271 (unsigned int) color_value[0], (unsigned int) color_value[1], (unsigned int)color_value[2], (color == 4) ? (unsigned int) color_value[3] : 0xFF); 273 272 274 273 return cairo_pattern_create_rgba( 275 274 (double) color_value[0] / (double) 0xFF, … … 416 415 } 417 416 418 if(verbosity!=0)419 lochstreifen_print_debug(l);417 lochstreifen_print_debug(l); 418 exit(0); 420 419 421 420 // setting up the surface and painting... -
paper-tape-project/trunk/visualisator/gtk.cc
r22 r76 19 19 loop.run(win); 20 20 } 21 22 23 #include "gtkpapertape.h"24 25 int main(int argc, char** argv) {26 Main loop(argc, argv);27 28 PaperTape::Chrome win;29 win.set_app_name("Hello World Application");30 31 win.show();32 loop.run(win);33 } -
paper-tape-project/trunk/visualisator/gtkpapertape.h
r22 r76 2 2 #define __GTK_PAPER_TAPE_H__ 3 3 4 /* 5 * Master include file, like "#include <gtk.h>" 6 * or "#include <gtkmm>". 4 #include "gtkmm/box.h" 5 #include "gtk/gtk.h" 6 #include <gtkmm/uimanager.h> 7 #include <gtkmm/dialog.h> 8 9 // predefine for usage in other header files 10 namespace Gtk 11 { class PaperTape; } 12 #include "gtkpapertapeview.h" 13 #include "gtkpapertapefile.h" 14 15 typedef unsigned char byte_t; 16 17 namespace Gtk { 18 19 /** 20 * Klasse könnte GtkWidget erweitern und dann selbst das Haupt 21 * master drumherumwidget sein, was automatisch richtige Kinder 22 * herzaubert, inkl. Scrolling und beispielsweise greaterzoom-ding. 23 * Oder dann das IO teil, usw. 7 24 * 8 */ 25 **/ 26 class PaperTape : public VBox 27 { 28 29 public: 30 PaperTapeView* view; 31 PaperTapeFile* model; 32 Window* parent_window; 33 34 private: 35 36 static Glib::ustring ui_info; 37 static GtkActionEntry ui_common_entries[]; 38 static GtkActionEntry ui_file_entries[]; 39 static GtkActionEntry ui_editor_entries[]; 40 static GtkToggleActionEntry ui_toggle_entries[]; 41 Glib::RefPtr<Gtk::UIManager> ui_manager; 42 void make_menu(); 43 void menu_actions(const Glib::RefPtr<Action>& action); 9 44 10 #include "lochstreifen.h" 11 #include "papertape/chrome.h" 12 #include "papertape/view.h" 13 #include "papertape/file.h" 45 public: 46 PaperTape(Window& parent_window); 47 48 /** 49 * Runs the dialog. This is just like dialog.run(), 50 * but with the correct parent window (modal dialog), 51 * which is saved in this widget. 52 **/ 53 int run_dialog(Dialog& dialog) { 54 dialog.set_transient_for(*this->parent_window); 55 return dialog.run(); 56 } 14 57 58 /** 59 * Open a blank file. This will ask if user wants to close 60 * file and open, if yes, a new blank file. 61 **/ 62 //void new_file(); 63 /** 64 * Show a file dialog to open an existing file. This will 65 * ask the user if he wants to close the current file. 66 **/ 67 //void open_file(); 68 /** 69 * Ask the user if he wants to close the current file. If so, 70 * close it, leaving with no file opened (splash screen) 71 **/ 72 //void close_file(); 73 /** 74 * Check if a file is opened. 75 * @returns true if a file is opened. 76 **/ 77 //boolean file_is_open(); 78 }; 79 80 81 }; // namespace Gtk 15 82 #endif // __GTK_PAPER_TAPE_H__ -
paper-tape-project/trunk/visualisator/lochstreifen.c
r73 r76 68 68 cairo_matrix_init(&l->matrix, 1, 0, 0, 1, 0, 0); // default = 1:1 original 69 69 l->matrix_inverse = l->matrix; 70 l->row_callback = NULL;71 l->row_callback_user_data = NULL;72 70 73 71 return l; … … 940 938 cairo_user_to_device(cr, &x, &y); 941 939 cairo_user_to_device_distance(cr, &width, &height); 942 //printf("draw: %i|%i %ix%i ", (int)x, (int)y, (int)width, (int)height);943 } //else printf("draw: ");944 //printf("row %i->%i track %i->%i\n", row, row_max, track_min, track_max);940 printf("draw: %i|%i %ix%i ", (int)x, (int)y, (int)width, (int)height); 941 } else printf("draw: "); 942 printf("row %i->%i track %i->%i\n", row, row_max, track_min, track_max); 945 943 946 944 // loop all the rows (bytes) … … 951 949 // call row callback 952 950 if(l->row_callback != NULL) { 953 printf("CALLING ROW CALLBACK!\n");954 951 (*l->row_callback) (&row, cr, l->row_callback_user_data); 955 952 // at least now that's all the magic ;) … … 998 995 } 999 996 1000 //printf("testing byte\n");1001 997 if( ((l->data[row] >> track) & 0x01) != 0x01) { 1002 998 // bit is logical ZERO (0)
Note: See TracChangeset
for help on using the changeset viewer.