#include <notepad_window.h>
Public Member Functions | |
CNotepadWindow () | |
~CNotepadWindow () | |
bool | init (bool create, const gchar *filename) |
GtkWidget * | getWindow () |
void | show (bool show) |
void | quit () |
void | scribble (CNPoint &pos, int status) |
void | erase (CNPoint &pos, int status) |
void | pageflip_or_create () |
void | pageflip_back () |
void | pageflip_forward () |
void | goto_relative_page (gint delta) |
void | goto_page () |
void | goto_page (gint pageno) |
void | insert_page () |
void | clear_current_page () |
void | delete_current_page () |
void | delete_current_page_impl () |
void | update_page_counter () |
void | update (bool full=true) |
void | set_scribble_mode (gboolean scribble_mode) |
gboolean | get_scribble_mode () |
gboolean | save (bool update_last_read=false) |
gboolean | rename () |
gchar * | getLabel () |
void | set_rotation (np_rotation nrotation) |
void | set_pageturn_inverted (gboolean is_inverted) |
const gchar * | getFilename () |
Definition at line 36 of file notepad_window.h.
notepad::CNotepadWindow::CNotepadWindow | ( | ) |
Definition at line 48 of file notepad_window.cpp.
00049 : main_window(0) 00050 , source(this) 00051 , notepad_doc() 00052 , notepad_pages() 00053 , gctx() 00054 , current_image(0) 00055 , erscribble_mode(TRUE) 00056 , erscribble_status(-1) 00057 , erase_status(-1) 00058 , current_page(1) 00059 , invert_pageturn(FALSE) 00060 , skip_expose_events(FALSE) 00061 , doublepagefliptimout(0) 00062 { 00063 00064 }
notepad::CNotepadWindow::~CNotepadWindow | ( | ) |
Definition at line 137 of file notepad_window.cpp.
References notepad::CNotepadDoc::close(), notepad::GCtx::gc, notepad::CNotepadDoc::set_last_read(), and notepad::CNotepadPages::stop().
00138 { 00139 notepad_doc.set_last_read(current_page); // store the current page number 00140 notepad_doc.close(); // close scribble 00141 disconnect_event_handlers(main_window); // unref GDK events 00142 notepad_pages.stop(); 00143 00144 if (main_window) 00145 { 00146 gtk_widget_destroy(main_window); 00147 main_window = 0; 00148 } 00149 if (gctx.gc != 0) 00150 { 00151 g_object_unref(G_OBJECT(gctx.gc)); 00152 gctx.gc = 0; 00153 } 00154 }
void notepad::CNotepadWindow::clear_current_page | ( | ) |
Definition at line 844 of file notepad_window.cpp.
References LOGPRINTF.
Referenced by notepad::on_menu_item().
00845 { 00846 LOGPRINTF("entry"); 00847 GtkWidget* surecleardialog = gtk_message_dialog_new( 00848 GTK_WINDOW(main_window), 00849 GTK_DIALOG_MODAL, 00850 GTK_MESSAGE_QUESTION, 00851 GTK_BUTTONS_YES_NO, 00852 _("Are you sure you want to clear the writing from this page?") ); 00853 00854 g_signal_connect(surecleardialog, 00855 "response", 00856 G_CALLBACK (CNotepadWindow::on_sureclear_dialog_response), 00857 static_cast<gpointer>(this) ); 00858 gtk_widget_show_all(surecleardialog); 00859 00860 LOGPRINTF("exit"); 00861 }
void notepad::CNotepadWindow::delete_current_page | ( | ) |
Definition at line 863 of file notepad_window.cpp.
References LOGPRINTF.
Referenced by notepad::on_menu_item().
00864 { 00865 LOGPRINTF("entry"); 00866 GtkWidget* suredeletedialog = gtk_message_dialog_new( 00867 GTK_WINDOW(main_window), 00868 GTK_DIALOG_MODAL, 00869 GTK_MESSAGE_QUESTION, 00870 GTK_BUTTONS_YES_NO, 00871 _("Are you sure you want to delete this page from the notepad?") ); 00872 00873 g_signal_connect(suredeletedialog, 00874 "response", 00875 G_CALLBACK (CNotepadWindow::on_suredelete_dialog_response), 00876 static_cast<gpointer>(this) ); 00877 gtk_widget_show_all(suredeletedialog); 00878 00879 LOGPRINTF("exit"); 00880 }
void notepad::CNotepadWindow::delete_current_page_impl | ( | ) |
Definition at line 882 of file notepad_window.cpp.
References notepad::CNotepadPages::clear_page(), notepad::CNotepadDoc::clear_page(), notepad::CNotepadPages::delete_page(), notepad::CNotepadDoc::delete_page(), notepad::CNotepadDoc::get_num_pages(), LOGPRINTF, update(), and update_page_counter().
00883 { 00884 LOGPRINTF("entry"); 00885 00886 if (notepad_doc.get_num_pages() <= 1) 00887 { 00888 LOGPRINTF("current_pages %d", current_page); 00889 current_page = 1; 00890 notepad_doc.clear_page(1); 00891 notepad_pages.clear_page(1); // force page cache update 00892 } 00893 else 00894 { 00895 notepad_doc.delete_page(current_page); 00896 // note: call pages.delete to keep pagecache in sync 00897 // note: perhaps place pages as layer between buffer and doc to prevent double call. 00898 notepad_pages.delete_page(current_page); 00899 LOGPRINTF("current_pages %d", current_page); 00900 00901 if (current_page > notepad_doc.get_num_pages()) 00902 { 00903 LOGPRINTF("current_pages %d", current_page); 00904 current_page = notepad_doc.get_num_pages(); 00905 } 00906 } 00907 update_page_counter(); 00908 update(); // show new page 00909 00910 LOGPRINTF("exit"); 00911 }
void notepad::CNotepadWindow::erase | ( | CNPoint & | pos, | |
int | status | |||
) |
Definition at line 550 of file notepad_window.cpp.
References notepad::CNotepadPages::mark_dirty(), notepad::CNotepadDoc::on_erase_begin(), notepad::CNotepadDoc::on_erase_end(), and notepad::CNotepadDoc::on_erase_move().
00551 { 00552 switch(status) 00553 { 00554 case 0: 00555 notepad_doc.on_erase_begin(current_page, gctx, current_image, pos); 00556 break; 00557 case 1: 00558 notepad_doc.on_erase_move(current_page, gctx, current_image, pos); 00559 break; 00560 case 2: 00561 notepad_doc.on_erase_end(current_page, gctx, current_image, pos); 00562 notepad_pages.mark_dirty(current_page); // mark dirty, deleted lines may overlap existing lines, so redraw is required 00563 break; 00564 default: 00565 break; 00566 } 00567 }
gboolean notepad::CNotepadWindow::get_scribble_mode | ( | ) |
Definition at line 1139 of file notepad_window.cpp.
Referenced by notepad::menu_show().
const gchar * notepad::CNotepadWindow::getFilename | ( | void | ) |
Definition at line 177 of file notepad_window.cpp.
References notepad::CFileStore::getFilename(), and notepad::CNotepadDoc::getFileStore().
00178 { 00179 CFileStore* store = notepad_doc.getFileStore(); 00180 return store->getFilename(); 00181 }
gchar * notepad::CNotepadWindow::getLabel | ( | ) |
Definition at line 171 of file notepad_window.cpp.
References notepad::CFileStore::getFileNameFilePartNoExt(), and notepad::CNotepadDoc::getFileStore().
00172 { 00173 CFileStore* store = notepad_doc.getFileStore(); 00174 return store->getFileNameFilePartNoExt(); 00175 }
GtkWidget * notepad::CNotepadWindow::getWindow | ( | ) |
Definition at line 166 of file notepad_window.cpp.
void notepad::CNotepadWindow::goto_page | ( | gint | pageno | ) |
Definition at line 689 of file notepad_window.cpp.
References notepad::CNotepadDoc::get_num_pages(), LOGPRINTF, save(), update(), and update_page_counter().
00690 { 00691 LOGPRINTF("entry %d", pageno); 00692 (void) save(); 00693 00694 current_page = pageno; 00695 if (current_page > notepad_doc.get_num_pages()) // limit to range 00696 { 00697 current_page = notepad_doc.get_num_pages(); 00698 } 00699 if (current_page < 1) 00700 { 00701 current_page = 1; 00702 } 00703 update_page_counter(); 00704 update(); // show new page 00705 00706 LOGPRINTF("exit"); 00707 }
void notepad::CNotepadWindow::goto_page | ( | ) |
Definition at line 674 of file notepad_window.cpp.
References ergtk_jump_to_page_dialog_new(), LOGPRINTF, notepad::menu_block(), and save().
Referenced by goto_relative_page(), and notepad::on_menu_item().
00675 { 00676 LOGPRINTF("entry"); 00677 (void) save(); 00678 00679 menu_block(TRUE); 00680 GtkWidget* jumptopagedialog = ergtk_jump_to_page_dialog_new(); 00681 g_signal_connect(jumptopagedialog, 00682 "response", 00683 G_CALLBACK (CNotepadWindow::on_jump_to_page_dialog_response), 00684 static_cast<gpointer>(this) ); 00685 gtk_widget_show_all(jumptopagedialog); 00686 LOGPRINTF("exit"); 00687 }
void notepad::CNotepadWindow::goto_relative_page | ( | gint | delta | ) |
Definition at line 650 of file notepad_window.cpp.
References goto_page(), and LOGPRINTF.
00651 { 00652 gint pageno = current_page + delta; 00653 LOGPRINTF("current_page %d delta %d pageno %d", current_page, delta, pageno); 00654 goto_page(pageno); 00655 }
bool notepad::CNotepadWindow::init | ( | bool | create, | |
const gchar * | filename | |||
) |
Definition at line 66 of file notepad_window.cpp.
References notepad::CNotepadDoc::create(), notepad::GCtx::gc, notepad::CNotepadDoc::get_last_read(), notepad::CNotepadDoc::get_num_pages(), notepad::CNotepadPages::init(), notepad::CNotepadDoc::insert_page(), notepad::menu_block(), notepad::NP_OK, and notepad::CNotepadDoc::open().
Referenced by main().
00067 { 00068 //document 00069 np_result res = NP_OK; 00070 if (docreate) 00071 { 00072 res = notepad_doc.create(filename); 00073 } 00074 else 00075 { 00076 res = notepad_doc.open(filename); 00077 } 00078 00079 if (res != NP_OK) 00080 { 00081 menu_block(TRUE); 00082 GtkWidget* openfaildialog = gtk_message_dialog_new( 00083 GTK_WINDOW(main_window), 00084 GTK_DIALOG_MODAL, 00085 GTK_MESSAGE_WARNING, 00086 GTK_BUTTONS_OK, 00087 (docreate) ? 00088 _("A new note cannot be created at this time. \n" 00089 "It is possible that the memory card is full. " 00090 "Consider deleting some items and then try again.") 00091 : 00092 _("The note could not be opened. \n" 00093 "It is possible that the file has been corrupted.")); 00094 00095 gtk_dialog_run(GTK_DIALOG(openfaildialog)); 00096 menu_block(FALSE); 00097 gtk_widget_destroy(openfaildialog); 00098 00099 return false; 00100 } 00101 00102 //window 00103 main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 00104 connect_event_handlers(main_window); 00105 g_signal_connect(main_window, "destroy", G_CALLBACK(gtk_widget_destroyed), &main_window); 00106 gtk_window_maximize(GTK_WINDOW(main_window)); 00107 00108 //page 00109 if ( notepad_doc.get_num_pages() < 1 ) 00110 { 00111 notepad_doc.insert_page(current_page); 00112 } 00113 else 00114 { 00115 int num = notepad_doc.get_last_read(); 00116 if (num > 0 ) 00117 { 00118 current_page = num; 00119 } 00120 } 00121 00122 // initialize pages cache 00123 gtk_widget_realize(main_window); // need gdk window now for depth/visual 00124 GdkVisual* visual = gdk_drawable_get_visual(GDK_DRAWABLE(main_window->window)); 00125 notepad_pages.init(¬epad_doc, &gctx, current_page, visual); 00126 00127 // create gdk graphical context 00128 if (gctx.gc == 0) 00129 { 00130 gctx.gc = gdk_gc_new(GDK_DRAWABLE(main_window->window)); 00131 } 00132 00133 00134 return true; 00135 }
void notepad::CNotepadWindow::insert_page | ( | ) |
Definition at line 790 of file notepad_window.cpp.
References notepad::CNotepadPages::insert_page(), notepad::CNotepadDoc::insert_page(), LOGPRINTF, save(), update(), and update_page_counter().
Referenced by notepad::on_menu_item().
00791 { 00792 LOGPRINTF("entry"); 00793 (void) save(); 00794 00795 notepad_doc.insert_page(current_page); 00796 // note: call pages.insert to keep pagecache in sync // note: perhaps place pages as layer between buffer and doc to prevent double call. 00797 notepad_pages.insert_page(current_page); 00798 00799 update_page_counter(); 00800 update(); // show new page 00801 00802 LOGPRINTF("exit"); 00803 }
void notepad::CNotepadWindow::pageflip_back | ( | ) |
Definition at line 749 of file notepad_window.cpp.
References LOGPRINTF, and notepad::static_pageflip().
Referenced by notepad::on_page_change().
00750 { 00751 LOGPRINTF("entry"); 00752 00753 if (doublepagefliptimout) 00754 { 00755 GSource* gsrc = g_main_context_find_source_by_id(NULL, doublepagefliptimout); 00756 g_source_destroy(gsrc); // restart delay 00757 --pageflipto; 00758 } 00759 else 00760 { 00761 pageflipto = current_page - 1; 00762 } 00763 00764 // delay 00765 doublepagefliptimout = g_timeout_add(500, static_pageflip, this); 00766 00767 LOGPRINTF("exit"); 00768 }
void notepad::CNotepadWindow::pageflip_forward | ( | ) |
Definition at line 770 of file notepad_window.cpp.
References LOGPRINTF, and notepad::static_pageflip().
Referenced by notepad::on_page_change().
00771 { 00772 LOGPRINTF("entry"); 00773 00774 if (doublepagefliptimout) 00775 { 00776 GSource* gsrc = g_main_context_find_source_by_id(NULL, doublepagefliptimout); 00777 g_source_destroy(gsrc); // restart delay 00778 ++pageflipto; 00779 } 00780 else 00781 { 00782 pageflipto = current_page + 1; 00783 } 00784 // delay 00785 doublepagefliptimout = g_timeout_add(500, static_pageflip, this); 00786 00787 LOGPRINTF("exit"); 00788 }
void notepad::CNotepadWindow::pageflip_or_create | ( | ) |
Definition at line 711 of file notepad_window.cpp.
References notepad::CNotepadDoc::add_page(), notepad::CNotepadDoc::get_num_pages(), notepad::CNotepadPages::insert_page(), LOGPRINTF, save(), update(), and update_page_counter().
Referenced by notepad::static_pageflip().
00712 { 00713 LOGPRINTF("entry %d", pageflipto); 00714 00715 // save previous page and set new page to screen 00716 save(); 00717 00718 current_page = pageflipto; 00719 00720 if (current_page < 1) 00721 { 00722 current_page = 1; 00723 } 00724 00725 if (current_page > notepad_doc.get_num_pages()) 00726 { 00727 current_page = notepad_doc.get_num_pages() + 1; 00728 notepad_doc.add_page(current_page); 00729 notepad_pages.insert_page(current_page); 00730 LOGPRINTF("increased: %d", current_page); 00731 } 00732 00733 LOGPRINTF("to %d", current_page); 00734 update_page_counter(); 00735 update(); // show new page 00736 00737 LOGPRINTF("exit"); 00738 doublepagefliptimout = 0; 00739 }
void notepad::CNotepadWindow::quit | ( | ) |
Definition at line 156 of file notepad_window.cpp.
References notepad::CNotepadDoc::getFileStore(), LOGPRINTF, notepad::GCtx::margin, and notepad::CNotepadPages::stop().
Referenced by notepad::on_menu_item(), notepad::on_prepare_unmount(), notepad::on_volume_unmounted(), and notepad::on_window_deactivated().
00157 { 00158 LOGPRINTF("entry"); 00159 00160 CThumbnail saveThumbnail(*notepad_doc.getFileStore(), notepad_pages, gctx.margin); // store thumbnail 00161 00162 notepad_pages.stop(); 00163 gtk_main_quit(); 00164 }
gboolean notepad::CNotepadWindow::rename | ( | ) |
Definition at line 1114 of file notepad_window.cpp.
References notepad::CNotepadDoc::get_filename_without_dir_and_ext(), LOGPRINTF, notepad::menu_block(), rename_dialog_create(), and save().
Referenced by notepad::on_menu_item().
01115 { 01116 LOGPRINTF("entry"); 01117 01118 menu_block(TRUE); 01119 (void) save(); 01120 gchar* my_file = notepad_doc.get_filename_without_dir_and_ext(); 01121 GtkWidget* renamedialog = rename_dialog_create(main_window, my_file); 01122 g_signal_connect(renamedialog, 01123 "response", 01124 G_CALLBACK (CNotepadWindow::on_rename_dialog_response), 01125 static_cast<gpointer>(this) ); 01126 01127 g_free(my_file); 01128 my_file = 0; 01129 LOGPRINTF("exit"); 01130 return FALSE; 01131 }
gboolean notepad::CNotepadWindow::save | ( | bool | update_last_read = false |
) |
Definition at line 927 of file notepad_window.cpp.
References notepad::CNotepadDoc::get_page_dirty(), notepad::CNotepadDoc::getFileStore(), notepad::GCtx::height, LOGPRINTF, notepad::GCtx::margin, notepad::NP_OK, notepad::CNotepadDoc::save_page(), WARNPRINTF, and notepad::GCtx::width.
Referenced by goto_page(), insert_page(), notepad::on_menu_item(), notepad::on_prepare_standby(), notepad::on_prepare_unmount(), notepad::on_window_activated(), notepad::on_window_deactivated(), pageflip_or_create(), rename(), and set_rotation().
00928 { 00929 if (gctx.width == 0 || gctx.height == 0) 00930 { 00931 WARNPRINTF("try to save in uninitialized state"); 00932 return FALSE; 00933 } 00934 00935 LOGPRINTF("entry"); 00936 00937 // save thumbnail of coverpage at changed page1 00938 if (current_page == 1 && notepad_doc.get_page_dirty()) 00939 { 00940 // Note: Call get_page_dirty (to determine need to save thumbnail) before save_page, 00941 // because doc.save_page resets the dirtyflag 00942 CThumbnail saveThumbnail(*notepad_doc.getFileStore(), notepad_pages, gctx.margin); 00943 } 00944 // save page 00945 np_result res = notepad_doc.save_page(current_page, update_last_read); 00946 00947 if (res != NP_OK) //exception 00948 { 00949 GtkWidget* save_failuredialog = gtk_message_dialog_new( 00950 GTK_WINDOW(main_window), 00951 GTK_DIALOG_MODAL, 00952 GTK_MESSAGE_WARNING, 00953 GTK_BUTTONS_OK, 00954 /* TRANSLATORS: 'Notes' refers to the name of the application */ 00955 _("The changes to the page could not be saved. \n" 00956 "Notes must close because of this problem.")); 00957 00958 00959 g_signal_connect(save_failuredialog, 00960 "response", 00961 G_CALLBACK (CNotepadWindow::on_failure_dialog_response), 00962 static_cast<gpointer>(this) ); 00963 gtk_widget_show_all(save_failuredialog); 00964 } 00965 00966 return (res == NP_OK); 00967 }
void notepad::CNotepadWindow::scribble | ( | CNPoint & | pos, | |
int | status | |||
) |
Definition at line 532 of file notepad_window.cpp.
References notepad::CNotepadDoc::on_scribble_begin(), notepad::CNotepadDoc::on_scribble_end(), and notepad::CNotepadDoc::on_scribble_move().
00533 { 00534 switch(status) 00535 { 00536 case 0: 00537 notepad_doc.on_scribble_begin(current_page, gctx, current_image, pos ); 00538 break; 00539 case 1: 00540 notepad_doc.on_scribble_move(current_page, gctx, current_image, pos ); 00541 break; 00542 case 2: 00543 notepad_doc.on_scribble_end(current_page, gctx, current_image, pos ); 00544 break; 00545 default: 00546 break; 00547 } 00548 }
void notepad::CNotepadWindow::set_pageturn_inverted | ( | gboolean | is_inverted | ) |
Definition at line 1144 of file notepad_window.cpp.
Referenced by main(), and notepad::on_changed_orientation().
void notepad::CNotepadWindow::set_rotation | ( | np_rotation | nrotation | ) |
Definition at line 309 of file notepad_window.cpp.
References notepad::GCtx::height, LOGPRINTF, notepad::GCtx::margin, notepad::CNotepadPages::mark_all_dirty(), notepad::GCtx::rotation, save(), notepad::CNPoint::setClipBorder(), notepad::CNPoint::setRotation(), notepad::CNPoint::setScreen(), and notepad::GCtx::width.
00310 { 00311 // drawn for the first time, or being resized/rotated: set dimensions, create new pixmap and draw 00312 LOGPRINTF("entry"); 00313 00314 if (gctx.width != 0 && gctx.height != 0) 00315 { 00316 // only in initialized state, that is: after first set_rotation() 00317 (void) save(); // save current page 00318 } 00319 00320 if (rotation != gctx.rotation) 00321 { 00322 LOGPRINTF("change rotation, erase page cache"); 00323 notepad_pages.mark_all_dirty(); // all cached pages are invalid because of rotation 00324 } 00325 00326 // inner border 00327 int width, height; 00328 gtk_window_get_size(GTK_WINDOW(main_window), &width, &height); 00329 00330 // root border 00331 int root_width, root_height; 00332 gdk_window_get_geometry(gdk_get_default_root_window(), NULL, NULL, &root_width, &root_height, NULL); 00333 00334 int posx = 0, posy = 0; 00335 gdk_window_get_position(main_window->window, &posx, &posy); 00336 00337 gctx.rotation = rotation; 00338 gctx.width = width; 00339 gctx.height = height; 00340 00341 int my_border = root_height - height; 00342 gctx.margin = my_border; 00343 00344 CNPoint::setRotation(rotation); 00345 CNPoint::setScreen(root_width, root_height); 00346 CNPoint::setClipBorder(my_border); 00347 00348 LOGPRINTF("gdk_window_get_position: x = %d, y = %d\n", posx, posy); 00349 LOGPRINTF("rotation %d", gctx.rotation); 00350 LOGPRINTF("root_widht %d, root_height %d", root_width, root_height); 00351 LOGPRINTF("widht %d, height %d", width, height); 00352 LOGPRINTF("border %d", my_border); 00353 00354 // Note: screen update called by on_expose event 00355 LOGPRINTF("exit"); 00356 }
void notepad::CNotepadWindow::set_scribble_mode | ( | gboolean | scribble_mode | ) |
Definition at line 1133 of file notepad_window.cpp.
References update().
Referenced by notepad::on_changed_pen(), and notepad::on_menu_item().
01134 { 01135 erscribble_mode = scribble_mode; 01136 update(false); // fills the whitespaces in strokes overlapped with erased strokes 01137 }
void notepad::CNotepadWindow::show | ( | bool | show | ) |
void notepad::CNotepadWindow::update | ( | bool | full = true |
) |
Definition at line 621 of file notepad_window.cpp.
References DM_HINT_FULL, notepad::GCtx::gc, notepad::CNotepadPages::get_page(), LOGPRINTF, notepad_on_idle_display_yield(), notepad_start_display_update(), and notepad_stop_display_update().
Referenced by delete_current_page_impl(), goto_page(), insert_page(), pageflip_or_create(), and set_scribble_mode().
00622 { 00623 LOGPRINTF("entry %d", current_page); 00624 00625 g_assert(gctx.gc != 0); 00626 00627 // Ask pages cache for page image. 00628 current_image = notepad_pages.get_page(current_page); 00629 00630 // draw current page image to screen 00631 draw_image_to_window(); 00632 00633 // draw gray page margin 00634 draw_page_margin(); 00635 00636 // screen update 00637 if (full) // default 00638 { 00639 notepad_stop_display_update(); // full display update 00640 notepad_on_idle_display_yield(DM_HINT_FULL); 00641 } 00642 else 00643 { 00644 notepad_start_display_update(); // nonflashing display update 00645 } 00646 00647 LOGPRINTF("exit"); 00648 }
void notepad::CNotepadWindow::update_page_counter | ( | ) |
Definition at line 913 of file notepad_window.cpp.
References notepad::CNotepadDoc::get_num_pages(), notepad::ipc_menu_set_pagecounter(), and LOGPRINTF.
Referenced by delete_current_page_impl(), goto_page(), insert_page(), notepad::menu_show(), notepad::on_window_activated(), and pageflip_or_create().
00914 { 00915 LOGPRINTF("entry"); 00916 ipc_menu_set_pagecounter(current_page, notepad_doc.get_num_pages() ); 00917 }