From c00d272bf76f8876a7df091e3284911208f4739c Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Sat, 7 Sep 2002 13:32:04 +0000 Subject: [PATCH] Added MC clipboard support --- docs/notework.txt | 9 +++ goldlib/gall/gall.all | 1 + goldlib/gall/gsnd.cpp | 3 +- goldlib/gall/gutlos.h | 9 --- goldlib/gall/gutlunix.cpp | 157 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 169 insertions(+), 10 deletions(-) create mode 100644 goldlib/gall/gutlunix.cpp diff --git a/docs/notework.txt b/docs/notework.txt index ea9dcef..f133ad4 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,15 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ ++ Added Midnight Commander compatible clipboard support for UNIX + version. Should only be available if "~/.cedit" directory exist at + GoldED+ startup time. (not tested) + +- Fixed problem with charset conversion on calling externutil with + kludges shown and reload option set. You should have reverse charset + table for this message (xlatlocalset to message charset) in order + this fix to work. + - Fixed small bug in the Crahmail/Crashecho parser when the last address may left unread. diff --git a/goldlib/gall/gall.all b/goldlib/gall/gall.all index a81937b..443a333 100644 --- a/goldlib/gall/gall.all +++ b/goldlib/gall/gall.all @@ -140,6 +140,7 @@ gutlos2 cpp all bco wco emx gutlos2m cpp all bco wco emx gutlwin cpp all bcx cyg gutlwinm cpp all bcx cyg +gutlunix cpp all lnx ## Low-level text video gvidbase cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg diff --git a/goldlib/gall/gsnd.cpp b/goldlib/gall/gsnd.cpp index fca6714..d2ce84a 100644 --- a/goldlib/gall/gsnd.cpp +++ b/goldlib/gall/gsnd.cpp @@ -37,6 +37,7 @@ #include #include #include +#include // ------------------------------------------------------------------ @@ -256,7 +257,7 @@ int gsnd::open(const char* file) { if(file_open) close(); - char buf[_MAX_PATH]; + char buf[GMAXPATH+sizeof("open alias noise wait")]; sprintf(buf, "open %s alias noise wait", file); if(g_send_mci_string(buf, NULL)) { file_open = true; diff --git a/goldlib/gall/gutlos.h b/goldlib/gall/gutlos.h index 20454c4..f70f288 100644 --- a/goldlib/gall/gutlos.h +++ b/goldlib/gall/gutlos.h @@ -33,11 +33,6 @@ #include -// ------------------------------------------------------------------ - -#if defined(__WIN32__) || defined(__OS2__) || defined(__DJGPP__) - - // ------------------------------------------------------------------ #define GUTLOS_FUNCS 1 @@ -81,7 +76,3 @@ char g_toupper(char); #endif // ------------------------------------------------------------------ - -#endif - -// ------------------------------------------------------------------ diff --git a/goldlib/gall/gutlunix.cpp b/goldlib/gall/gutlunix.cpp new file mode 100644 index 0000000..5ffe96a --- /dev/null +++ b/goldlib/gall/gutlunix.cpp @@ -0,0 +1,157 @@ +// This may look like C code, but it is really -*- C++ -*- + +// ------------------------------------------------------------------ +// The Goldware Library +// Copyright (C) 1999 Alexander S. Aganichev +// ------------------------------------------------------------------ +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library 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 +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library 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 +// ------------------------------------------------------------------ +// $Id$ +// ------------------------------------------------------------------ +// Midnight Commander compatible clipboard. +// ------------------------------------------------------------------ + +#include +#include +#include +#include +#include +#include +#include + + +// ------------------------------------------------------------------ + +#define CLIPDIR "~/.cedit" +#define CLIPFILE "~/.cedit/cooledit.clip" + + +// ------------------------------------------------------------------ + +int g_init_os(int flags) { + + NW(flags); + return 0; +} + + +// ------------------------------------------------------------------ + +void g_deinit_os(void) { + + // do nothing +} + + +// ------------------------------------------------------------------ + +void g_init_title(char *tasktitle, int titlestatus) { + + NW(tasktitle); NW(titlestatus); +} + + +// ------------------------------------------------------------------ + +void g_increase_priority(void) { + + // Do nothing +} + + +// ------------------------------------------------------------------ + +void g_set_ostitle(char* title, word dx) { + + NW(title); NW(dx); +} + + +// ------------------------------------------------------------------ + +void g_set_osicon(void) { + + // do nothing +} + + +// ------------------------------------------------------------------ + +bool g_is_clip_available(void) { + + return is_dir(CLIPDIR); +} + + +// ------------------------------------------------------------------ + +char* g_get_clip_text(void) { + + size_t size = GetFilesize(CLIPFILE); + char *text = (char *)throw_malloc(size+1); + *text = NUL; + + FILE *f = fopen(CLIPFILE, "rt"); + if(f != NULL) { + fread(text, 1, size, f); + text[size] = NUL; + fclose(f); + } + + return text; +} + + +// ------------------------------------------------------------------ + +int g_put_clip_text(const char* buf) { + + FILE *f = fopen(CLIPFILE, "wt"); + if(f != NULL) { + fwrite(buf, 1, strlen(buf), f); + fclose(f); + return 0; + } + return -1; +} + + +// ------------------------------------------------------------------ + +void g_get_ostitle_name(char* title) { + + *title = NUL; +} + + +// ------------------------------------------------------------------ + +void g_set_ostitle_name(char* title, int mode) { + + NW(title); NW(mode); +} + + +// ------------------------------------------------------------------ + +int g_send_mci_string(char* str, char* his_buffer) { + + NW(str); NW(his_buffer); + return 1; +} + + +// ------------------------------------------------------------------