Revision: 18961
http://vice-emu.svn.sourceforge.net/vice-emu/?rev=18961&view=rev
Author: blackystardust
Date: 2008-07-04 16:09:30 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
Added copy/paste support to the BeOS port.
Modified Paths:
--------------
branches/marco/ports/vice/src/arch/beos/Makefile.am
branches/marco/ports/vice/src/arch/beos/console.c
branches/marco/ports/vice/src/arch/beos/constants.h
branches/marco/ports/vice/src/arch/beos/ui.cc
branches/marco/ports/vice/src/arch/beos/ui_sid.cc
branches/marco/ports/vice/src/arch/beos/vicemenu.cc
branches/marco/ports/vice/src/clipboard.h
Modified: branches/marco/ports/vice/src/arch/beos/Makefile.am
===================================================================
--- branches/marco/ports/vice/src/arch/beos/Makefile.am 2008-07-04 19:16:46 UTC (rev 18960)
+++ branches/marco/ports/vice/src/arch/beos/Makefile.am 2008-07-04 23:09:30 UTC (rev 18961)
@@ -8,6 +8,7 @@
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/drive \
-I$(top_srcdir)/src/vdrive \
+ -I$(top_srcdir)/src/monitor \
-I$(top_srcdir)/src/c64 \
-I$(top_srcdir)/src/c128 \
-I$(top_srcdir)/src/vic20 \
Modified: branches/marco/ports/vice/src/arch/beos/console.c
===================================================================
--- branches/marco/ports/vice/src/arch/beos/console.c 2008-07-04 19:16:46 UTC (rev 18960)
+++ branches/marco/ports/vice/src/arch/beos/console.c 2008-07-04 23:09:30 UTC (rev 18961)
@@ -53,7 +53,7 @@
#else
char *readline(const char *prompt)
{
- char *p, *v;
+ char *p, *rv;
console_out(NULL, "%s", prompt);
fflush(stdout);
Modified: branches/marco/ports/vice/src/arch/beos/constants.h
===================================================================
--- branches/marco/ports/vice/src/arch/beos/constants.h 2008-07-04 19:16:46 UTC (rev 18960)
+++ branches/marco/ports/vice/src/arch/beos/constants.h 2008-07-04 23:09:30 UTC (rev 18961)
@@ -111,6 +111,9 @@
const uint32 ATTACH_C64_CART = 'MA01';
const uint32 ATTACH_VIC20_CART = 'MA02';
+const uint32 MENU_COPY = 'M161';
+const uint32 MENU_PASTE = 'M162';
+
const uint32 MENU_TOGGLE_SOUND = 'M100';
const uint32 MENU_TOGGLE_WARP_MODE = 'M101';
const uint32 MENU_TOGGLE_DRIVE_TRUE_EMULATION = 'M102';
Modified: branches/marco/ports/vice/src/arch/beos/ui.cc
===================================================================
--- branches/marco/ports/vice/src/arch/beos/ui.cc 2008-07-04 19:16:46 UTC (rev 18960)
+++ branches/marco/ports/vice/src/arch/beos/ui.cc 2008-07-04 23:09:30 UTC (rev 18961)
@@ -28,6 +28,7 @@
#include <Alert.h>
#include <Application.h>
+#include <Clipboard.h>
#include <FilePanel.h>
#include <Menu.h>
#include <MenuBar.h>
@@ -46,7 +47,9 @@
#include "attach.h"
#include "autostart.h"
#include "archdep.h"
+#include "charset.h"
#include "cmdline.h"
+#include "clipboard.h"
#include "constants.h"
#include "datasette.h"
#include "drive.h"
@@ -57,6 +60,7 @@
#include "interrupt.h"
#include "joy.h"
#include "kbd.h"
+#include "kbdbuf.h"
#include "keyboard.h"
#include "lib.h"
#include "log.h"
@@ -426,7 +430,56 @@
return is_paused;
}
+static void ui_copy_clipboard(void)
+{
+ BMessage *clippy = (BMessage *)NULL;
+ char *text = NULL;
+ text = clipboard_read_screen_output("\n");
+
+ if (text != NULL)
+ {
+ if (be_clipboard->Lock())
+ {
+ be_clipboard->Clear();
+ if (clippy = be_clipboard->Data())
+ {
+ clippy->AddData("text/plain", B_MIME_TYPE, text, strlen(text));
+ be_clipboard->Commit();
+ }
+ be_clipboard->Unlock();
+ }
+ lib_free(text);
+ }
+}
+
+static void ui_paste_clipboard_text(void)
+{
+ const char *text;
+ char *text_in_petscii = NULL;
+ int32 textlen = 0;
+ BMessage *clippy = (BMessage *)NULL;
+
+ if (be_clipboard->Lock())
+ {
+ if (clippy = be_clipboard->Data())
+ {
+ clippy->FindData("text/plain", B_MIME_TYPE, (const void **)&text, &textlen);
+
+ if (textlen != 0)
+ {
+ text_in_petscii = (char *)lib_malloc(textlen + 1);
+ memcpy(text_in_petscii, text, textlen);
+ text_in_petscii[textlen] = 0;
+ charset_petconvstring((unsigned char *)text_in_petscii, 0);
+ kbdbuf_feed(text_in_petscii);
+ lib_free(text_in_petscii);
+ }
+ }
+ be_clipboard->Unlock();
+ }
+}
+
/* here the stuff for queueing and dispatching ui commands */
/*---------------------------------------------------------*/
#define MAX_MESSAGE_QUEUE_SIZE 256
@@ -638,6 +691,12 @@
case MENU_PAUSE:
ui_pause_emulation();
break;
+ case MENU_COPY:
+ ui_copy_clipboard();
+ break;
+ case MENU_PASTE:
+ ui_paste_clipboard_text();
+ break;
case MENU_SOUND_RECORD_AIFF:
ui_select_file(windowlist[0]->savepanel,AIFF_FILE,(void*)0);
resources_set_string("SoundRecordDeviceName", "");
Modified: branches/marco/ports/vice/src/arch/beos/ui_sid.cc
===================================================================
--- branches/marco/ports/vice/src/arch/beos/ui_sid.cc 2008-07-04 19:16:46 UTC (rev 18960)
+++ branches/marco/ports/vice/src/arch/beos/ui_sid.cc 2008-07-04 23:09:30 UTC (rev 18961)
@@ -88,12 +88,13 @@
void CreateAndGetAddressList(BListView *addresslistview, int mode)
{
- /* mode: 0=Create 1=get */
+ /* mode: 0=Create 1=get */
char st[12];
int res_value;
int adr, ladr, hi, index = -1;
int *hadr;
- int cursel = addresslistview->CurrentSelection();
+ int cursel = addresslistview->CurrentSelection();
+ BListItem *item;
resources_get_int("SidStereoAddressStart", &res_value);
Modified: branches/marco/ports/vice/src/arch/beos/vicemenu.cc
===================================================================
--- branches/marco/ports/vice/src/arch/beos/vicemenu.cc 2008-07-04 19:16:46 UTC (rev 18960)
+++ branches/marco/ports/vice/src/arch/beos/vicemenu.cc 2008-07-04 23:09:30 UTC (rev 18961)
@@ -256,6 +256,16 @@
menu->AddItem(new BMenuItem("Quit",
new BMessage(MENU_EXIT_REQUESTED), 'Q'));
+ /* create the EDIT menu */
+ menu = new BMenu("Edit");
+ menubar->AddItem(menu);
+ if (!vsid_mode) {
+ menu->AddItem(new BMenuItem("Copy",
+ new BMessage(MENU_COPY)));
+ menu->AddItem(new BMenuItem("Paste",
+ new BMessage(MENU_PASTE)));
+ }
+
/* create the OPTIONS menu */
menu = new BMenu("Options");
menubar->AddItem(menu);
Modified: branches/marco/ports/vice/src/clipboard.h
===================================================================
--- branches/marco/ports/vice/src/clipboard.h 2008-07-04 19:16:46 UTC (rev 18960)
+++ branches/marco/ports/vice/src/clipboard.h 2008-07-04 23:09:30 UTC (rev 18961)
@@ -1,35 +1,35 @@
-/*
- * clipboard.c - Common clipboard related functions.
- *
- * Written by
- * Spiro Trikaliotis <Spi...@gm...>
- * Marco van den Heuvel <bla...@ya...>
- *
- * This file is part of VICE, the Versatile Commodore Emulator.
- * See README for copyright notice.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA.
- *
- */
-
-#ifndef _CLIPBOARD_H
-#define _CLIPBOARD_H
-
-#include "vice.h"
-
-extern char *clipboard_read_screen_output(char *line_ending);
-
-#endif
+/*
+ * clipboard.c - Common clipboard related functions.
+ *
+ * Written by
+ * Spiro Trikaliotis <Spi...@gm...>
+ * Marco van den Heuvel <bla...@ya...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#ifndef _VICE_CLIPBOARD_H
+#define _VICE_CLIPBOARD_H
+
+#include "vice.h"
+
+extern char *clipboard_read_screen_output(char *line_ending);
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|