changeset 55:a1f38544fab6

copy image/link location
author jcid
date Sun, 18 Nov 2007 21:17:27 +0100
parents 74988212be40
children 7bf5884218c4
files ChangeLog README src/menu.cc src/uicmd.cc src/uicmd.hh
diffstat 5 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Nov 18 17:23:16 2007 +0100
+++ b/ChangeLog	Sun Nov 18 21:17:27 2007 +0100
@@ -56,6 +56,7 @@
  - Added a save-directory preference (save_dir in dillorc2).
  - Fixed page-popup-menu to use the stack's top URL instead of base_url.
  - Added the "static" qualifier where missing.
+ - Bound "Copy link location".
    Patches: place
 +- Fixed a problem with locally-installed dpis.
  - Added code for optional image loading (nice interface) very advanced!
--- a/README	Sun Nov 18 17:23:16 2007 +0100
+++ b/README	Sun Nov 18 21:17:27 2007 +0100
@@ -26,9 +26,9 @@
          * you may experience crashes from "assert" statements from
            unfinished code.
 Fixed    * context menus are not yet completely hooked or activated
-         * Selecting text with the mouse is half hooked. This is, you
+Fixed    * Selecting text with the mouse is half hooked. This is, you
            can see the selected text in the terminal but can't paste.
-         * Searching for text is not yet hooked. Look in test/ directory
+Advanced * Searching for text is not yet hooked. Look in test/ directory
            of dw2 for an example of find text.
 Advanced * Form elements are not yet hooked/implemented. You can look
            in dw2' test/dw_ui_test.cc to see what's already done.
--- a/src/menu.cc	Sun Nov 18 17:23:16 2007 +0100
+++ b/src/menu.cc	Sun Nov 18 21:17:27 2007 +0100
@@ -70,9 +70,10 @@
 
 
 //--------------------------------------------------------------------------
-static void Menu_unimplemented_cb(Widget*)
+static void Menu_copy_urlstr_cb(Widget *)
 {
-   MSG("Menu_unimplemented_cb: click! :-)\n");
+   if (popup_url)
+      a_UIcmd_copy_urlstr(popup_bw, URL_STR(popup_url));
 }
 
 static void Menu_link_cb(Widget*, void *user_data)
@@ -302,8 +303,7 @@
        i = new Item("Bookmark this Link");
        i->callback(Menu_add_bookmark_cb);
        i = new Item("Copy Link location");
-       i->callback(Menu_unimplemented_cb);
-       i->deactivate();
+       i->callback(Menu_copy_urlstr_cb);
        new Divider();    
        i = new Item("Save Link As...");
        i->callback(Menu_save_link_cb);
@@ -348,8 +348,7 @@
        i = new Item("Bookmark this Image");
        i->callback(Menu_add_bookmark_cb);
        i = new Item("Copy Image location");
-       i->callback(Menu_unimplemented_cb);
-       i->deactivate();
+       i->callback(Menu_copy_urlstr_cb);
        new Divider();
        i = new Item("Save Image As...");
        i->callback(Menu_save_link_cb);
--- a/src/uicmd.cc	Sun Nov 18 17:23:16 2007 +0100
+++ b/src/uicmd.cc	Sun Nov 18 21:17:27 2007 +0100
@@ -469,6 +469,15 @@
 }
 
 /*
+ * Copy url string to paste buffer
+ */
+void a_UIcmd_copy_urlstr(BrowserWindow *bw, const char *urlstr)
+{
+   Layout *layout = (Layout*)bw->render_layout;
+   layout->copySelection(urlstr);
+}
+
+/*
  * Show a text window with the URL's source
  */
 void a_UIcmd_view_page_source(const DilloUrl *url)
--- a/src/uicmd.hh	Sun Nov 18 17:23:16 2007 +0100
+++ b/src/uicmd.hh	Sun Nov 18 21:17:27 2007 +0100
@@ -31,6 +31,7 @@
                         const char *bugs_txt, int prefs_load_images);
 void a_UIcmd_link_popup(void *vbw, const DilloUrl *url);
 void a_UIcmd_image_popup(void *vbw, const DilloUrl *url, DilloUrl *link_url);
+void a_UIcmd_copy_urlstr(BrowserWindow *bw, const char *urlstr);
 void a_UIcmd_view_page_source(const DilloUrl *url);
 void a_UIcmd_view_page_bugs(void *vbw);
 void a_UIcmd_bugmeter_popup(void *vbw);