summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/newt/entry.c
blob: 1b33f1c6f34009c85375141bd7b2c43aa63a0973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Diffstat (limited to 'po/ja.po')
-rw-r--r--po/ja.po134
1 files changed, 70 insertions, 64 deletions
diff --git a/po/ja.po b/po/ja.po
index 39062d2..0bad49b 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -8,7 +8,7 @@
msgid ""
msgstr ""
"Project-Id-Version: drakx-net-ja\n"
-"POT-Creation-Date: 2007-08-09 11:47+0200\n"
+"POT-Creation-Date: 2007-08-28 11:27+0200\n"
"PO-Revision-Date: 2007-08-17 10:00+0900\n"
"Last-Translator: Yukiko Bando <ybando@k6.dion.ne.jp>\n"
"Language-Team: Japanese <cooker-i18n@mandrivalinux.org>\n"
@@ -4698,6 +4698,57 @@ msgstr "Virtual Circuit ID (VCI):"
msgid "Could not install the packages (%s)!"
msgstr "パッケージ (%s) をインストールできませんでした"
+#: ../lib/network/connection_manager.pm:54
+#: ../lib/network/connection_manager.pm:86
+#, c-format
+msgid "Please enter settings for network"
+msgstr "ネットワークの設定を入力してください"
+
+#: ../lib/network/connection_manager.pm:58 ../lib/network/netconnect.pm:177
+#, c-format
+msgid "Configuring device..."
+msgstr "デバイスを設定..."
+
+#: ../lib/network/connection_manager.pm:132
+#, c-format
+msgid "Connecting..."
+msgstr "接続..."
+
+#: ../lib/network/connection_manager.pm:150
+#, c-format
+msgid "Disconnecting..."
+msgstr "切断します..."
+
+#: ../lib/network/connection_manager.pm:187
+#, c-format
+msgid "SSID"
+msgstr "SSID"
+
+#: ../lib/network/connection_manager.pm:188
+#, c-format
+msgid "Signal strength"
+msgstr "信号強度"
+
+#: ../lib/network/connection_manager.pm:189
+#, c-format
+msgid "Encryption"
+msgstr "暗号化"
+
+#: ../lib/network/connection_manager.pm:222 ../lib/network/netconnect.pm:209
+#, c-format
+msgid "Scanning for networks..."
+msgstr "ネットワークをスキャンしています..."
+
+#: ../lib/network/connection_manager.pm:260 ../lib/network/drakroam.pm:111
+#, c-format
+msgid "Disconnect"
+msgstr "切断"
+
+#: ../lib/network/connection_manager.pm:260 ../lib/network/drakroam.pm:110
+#, c-format
+msgid "Connect"
+msgstr "接続"
+
#: ../lib/network/drakfirewall.pm:12
#, c-format
msgid "Web Server"
@@ -4863,76 +4914,26 @@ msgstr "対話式ファイアウォールを使う"
msgid "No device found"
msgstr "デバイスが見つかりません"
-#: ../lib/network/drakroam.pm:63 ../lib/network/drakroam.pm:161
-#, c-format
-msgid "Please enter settings for network"
-msgstr "ネットワークの設定を入力してください"
-
-#: ../lib/network/drakroam.pm:67 ../lib/network/netconnect.pm:177
-#, c-format
-msgid "Configuring device..."
-msgstr "デバイスを設定..."
-
-#: ../lib/network/drakroam.pm:95
+#: ../lib/network/drakroam.pm:58
#, c-format
msgid "Hostname changed to \"%s\""
msgstr "ホスト名が \"%s\" に変わりました"
-#: ../lib/network/drakroam.pm:108 ../lib/network/netconnect.pm:209
-#, c-format
-msgid "Scanning for networks..."
-msgstr "ネットワークをスキャンしています..."
-
-#: ../lib/network/drakroam.pm:200
-#, c-format
-msgid "Connecting..."
-msgstr "接続..."
-
-#: ../lib/network/drakroam.pm:227
-#, c-format
-msgid "Disconnect"
-msgstr "切断"
-
-#: ../lib/network/drakroam.pm:227
-#, c-format
-msgid "Connect"
-msgstr "接続"
-
-#: ../lib/network/drakroam.pm:250
-#, c-format
-msgid "Disconnecting..."
-msgstr "切断します..."
-
-#: ../lib/network/drakroam.pm:279
-#, c-format
-msgid "SSID"
-msgstr "SSID"
-
-#: ../lib/network/drakroam.pm:280
-#, c-format
-msgid "Signal strength"
-msgstr "信号強度"
-
-#: ../lib/network/drakroam.pm:281
-#, c-format
-msgid "Encryption"
-msgstr "暗号化"
-
-#: ../lib/network/drakroam.pm:335 ../lib/network/netconnect.pm:761
-#, c-format
-msgid "Wireless connection"
-msgstr "ワイヤレス接続"
-
-#: ../lib/network/drakroam.pm:350
+#: ../lib/network/drakroam.pm:109 ../lib/network/netcenter.pm:80
#, c-format
msgid "Configure"
msgstr "設定"
-#: ../lib/network/drakroam.pm:352
+#: ../lib/network/drakroam.pm:113 ../lib/network/netcenter.pm:85
#, c-format
msgid "Refresh"
msgstr "更新"
+#: ../lib/network/drakroam.pm:124 ../lib/network/netconnect.pm:761
+#, c-format
+msgid "Wireless connection"
+msgstr "ワイヤレス接続"
+
#: ../lib/network/drakvpn.pm:30
#, c-format
msgid "VPN configuration"
@@ -5140,6 +5141,16 @@ msgstr "デバイスを選択:"
msgid "Network Center"
msgstr "ネットワークセンター"
+#: ../lib/network/netcenter.pm:71 ../lib/network/netconnect.pm:212
+#, c-format
+msgid "Please select your network:"
+msgstr "ネットワークを選んでください:"
+
+#: ../lib/network/netcenter.pm:76
+#, fuzzy, c-format
+msgid "Monitor"
+msgstr "ネットワークをモニタ"
+
#: ../lib/network/netconnect.pm:37
#, c-format
msgid "United States"
@@ -5187,11 +5198,6 @@ msgstr "ハードウェアの設定"
msgid "Please select your provider:"
msgstr "プロバイダを選んでください:"
-#: ../lib/network/netconnect.pm:212
-#, c-format
-msgid "Please select your network:"
-msgstr "ネットワークを選んでください:"
-
#: ../lib/network/netconnect.pm:241
#, c-format
msgid ""
/a> 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
#include <ctype.h>
#include <slang.h>
#include <stdlib.h>
#include <string.h>

#include "newt.h"
#include "newt_pr.h"

struct entry {
    int flags;
    char * buf;
    char ** resultPtr;
    int bufAlloced;
    int bufUsed;		/* amount of the buffer that's been used */
    int cursorPosition; 	/* cursor *in the string* on on screen */
    int firstChar;		/* first character position being shown */
    newtEntryFilter filter;
    void * filterData;
};

static void entryDraw(newtComponent co);
static void entryDestroy(newtComponent co);
static struct eventResult entryEvent(newtComponent co,
			             struct event ev);

static struct eventResult entryHandleKey(newtComponent co, int key);

static struct componentOps entryOps = {
    entryDraw,
    entryEvent,
    entryDestroy,
    newtDefaultPlaceHandler,
    newtDefaultMappedHandler,
} ;

void newtEntrySet(newtComponent co, const char * value, int cursorAtEnd) {
    struct entry * en = co->data;

    if ((strlen(value) + 1) > (unsigned int)en->bufAlloced) {
	free(en->buf);
	en->bufAlloced = strlen(value) + 1;
	en->buf = malloc(en->bufAlloced);
	if (en->resultPtr) *en->resultPtr = en->buf;
    }
    memset(en->buf, 0, en->bufAlloced);		/* clear the buffer */
    strcpy(en->buf, value);
    en->bufUsed = strlen(value);
    en->firstChar = 0;
    if (cursorAtEnd)
	en->cursorPosition = en->bufUsed;
    else
	en->cursorPosition = 0;

    entryDraw(co);
} ;

newtComponent newtEntry(int left, int top, const char * initialValue, int width,
			char ** resultPtr, int flags) {
    newtComponent co;
    struct entry * en;

    co = malloc(sizeof(*co));
    en = malloc(sizeof(struct entry));
    co->data = en;

    co->top = top;
    co->left = left;
    co->height = 1;
    co->width = width;
    co->isMapped = 0;
    co->callback = NULL;

    co->ops = &entryOps;

    en->flags = flags;
    en->cursorPosition = 0;
    en->firstChar = 0;
    en->bufUsed = 0;
    en->bufAlloced = width + 1;
    en->filter = NULL;

    if (!(en->flags & NEWT_FLAG_DISABLED))
	co->takesFocus = 1;
    else
	co->takesFocus = 0;

    if (initialValue && strlen(initialValue) > (unsigned int)width) {
	en->bufAlloced = strlen(initialValue) + 1;
    }
    en->buf = malloc(en->bufAlloced);
    en->resultPtr = resultPtr;
    if (en->resultPtr) *en->resultPtr = en->buf;

    memset(en->buf, 0, en->bufAlloced);
    if (initialValue) {
	strcpy(en->buf, initialValue);
	en->bufUsed = strlen(initialValue);
	en->cursorPosition = en->bufUsed;
    } else {
	*en->buf = '\0';
	en->bufUsed = 0;
	en->cursorPosition = 0;
    }

    return co;
}

static void entryDraw(newtComponent co) {
    struct entry * en = co->data;
    int i;
    char * chptr;
    int len;

    if (!co->isMapped) return;

    if (en->flags & NEWT_FLAG_DISABLED)
	SLsmg_set_color(NEWT_COLORSET_DISENTRY);
    else
	SLsmg_set_color(NEWT_COLORSET_ENTRY);

    if (en->flags & NEWT_FLAG_HIDDEN) {
	newtGotorc(co->top, co->left);
	for (i = 0; i < co->width; i++)
	    SLsmg_write_char('_');
	newtGotorc(co->top, co->left);

	return;
    }

    newtGotorc(co->top, co->left);

    if (en->cursorPosition < en->firstChar) {
	/* scroll to the left */
	en->firstChar = en->cursorPosition;
    } else if ((en->firstChar + co->width) <= en->cursorPosition) {
	/* scroll to the right */
	en->firstChar = en->cursorPosition - co->width + 1;
    }

    chptr = en->buf + en->firstChar;

    if (en->flags & NEWT_FLAG_PASSWORD) {
	char *tmpptr, *p;

	tmpptr = alloca(strlen(chptr+2));
	strcpy(tmpptr, chptr);
	for (p = tmpptr; *p; p++)
	    *p = '*';
	chptr = tmpptr;
    }			

    len = strlen(chptr);

    if (len <= co->width) {
	i = len;
	SLsmg_write_string(chptr);
	while (i < co->width) {
	    SLsmg_write_char('_');
	    i++;
	}
    } else {
	SLsmg_write_nstring(chptr, co->width);
    }

    if (en->flags & NEWT_FLAG_HIDDEN)
	newtGotorc(co->top, co->left);
    else
	newtGotorc(co->top, co->left + (en->cursorPosition - en->firstChar));
}

void newtEntrySetFlags(newtComponent co, int flags, enum newtFlagsSense sense) {
    struct entry * en = co->data;
    int row, col;

    en->flags = newtSetFlags(en->flags, flags, sense);

    if (!(en->flags & NEWT_FLAG_DISABLED))
	co->takesFocus = 1;
    else
	co->takesFocus = 0;

    newtGetrc(&row, &col);
    entryDraw(co);
    newtGotorc(row, col);
}

static void entryDestroy(newtComponent co) {
    struct entry * en = co->data;

    free(en->buf);
    free(en);
    free(co);
}

static struct eventResult entryEvent(newtComponent co,
				     struct event ev) {
    struct entry * en = co->data;
    struct eventResult er;
    int ch;

    if (ev.when == EV_NORMAL) {
	switch (ev.event) {
	case EV_FOCUS:
	    newtCursorOn();
	    if (en->flags & NEWT_FLAG_HIDDEN)
		newtGotorc(co->top, co->left);
	    else
		newtGotorc(co->top, co->left +
			   (en->cursorPosition - en->firstChar));
	    er.result = ER_SWALLOWED;
	    break;

	case EV_UNFOCUS:
	    newtCursorOff();
	    newtGotorc(0, 0);
	    er.result = ER_SWALLOWED;
	    if (co->callback)
		co->callback(co, co->callbackData);
	    break;

	case EV_KEYPRESS:
	    ch = ev.u.key;
	    if (en->filter)
		ch = en->filter(co, en->filterData, ch, en->cursorPosition);
	    if (ch) er = entryHandleKey(co, ch);
	    break;

	case EV_MOUSE:
	    if ((ev.u.mouse.type == MOUSE_BUTTON_DOWN) &&
		(en->flags ^ NEWT_FLAG_HIDDEN)) {
		if (strlen(en->buf) >= (size_t) (ev.u.mouse.x - co->left)) {
		    en->cursorPosition = ev.u.mouse.x - co->left;
		    newtGotorc(co->top,
			       co->left +(en->cursorPosition - en->firstChar));
		} else {
		    en->cursorPosition = strlen(en->buf);
		    newtGotorc(co->top,
			       co->left +(en->cursorPosition - en->firstChar));
		}
	    }
	    break;
	}
    } else
	er.result = ER_IGNORED;

    return er;
}

static struct eventResult entryHandleKey(newtComponent co, int key) {
    struct entry * en = co->data;
    struct eventResult er;
    char * chptr, * insPoint;

    er.result = ER_SWALLOWED;
    switch (key) {
      case '\r':				/* Return */
	if (en->flags & NEWT_FLAG_RETURNEXIT) {
	    er.result = ER_EXITFORM;
	} else {
	    er.result = ER_NEXTCOMP;
	}
	break;

      case '\001':				/* ^A */
      case NEWT_KEY_HOME:
	en->cursorPosition = 0;
	break;

      case '\005':				/* ^E */
      case NEWT_KEY_END:
	en->cursorPosition = en->bufUsed;
	break;

      case '\013':				/* ^K */
	en->bufUsed = en->cursorPosition;
	memset(en->buf + en->bufUsed, 0, en->bufAlloced - en->bufUsed);
	break;

      case '\002':				/* ^B */
      case NEWT_KEY_LEFT:
	if (en->cursorPosition)
	    en->cursorPosition--;
	break;

      case '\004':
      case NEWT_KEY_DELETE:
	chptr = en->buf + en->cursorPosition;
	if (*chptr) {
	    chptr++;
	    while (*chptr) {
		*(chptr - 1) = *chptr;
		chptr++;
	    }
	    *(chptr - 1) = '\0';
	    en->bufUsed--;
	}
	break;

      case NEWT_KEY_BKSPC:
	if (en->cursorPosition) {
	    /* if this isn't true, there's nothing to erase */
	    chptr = en->buf + en->cursorPosition;
	    en->bufUsed--;
	    en->cursorPosition--;
	    while (*chptr) {
		*(chptr - 1) = *chptr;
		chptr++;
	    }
	    *(chptr - 1) = '\0';
	}
	break;

      case '\006':				/* ^B */
      case NEWT_KEY_RIGHT:
	if (en->cursorPosition < en->bufUsed)
	    en->cursorPosition++;
	break;

      default:
	if ((key >= 0x20 && key <= 0x7e) || (key >= 0xa0 && key <= 0xff)) {
	    if (!(en->flags & NEWT_FLAG_SCROLL) && en->bufUsed >= co->width) {
		SLtt_beep();
		break;
	    }

	    if ((en->bufUsed + 1) == en->bufAlloced) {
		en->bufAlloced += 20;
		en->buf = realloc(en->buf, en->bufAlloced);
		if (en->resultPtr) *en->resultPtr = en->buf;
		memset(en->buf + en->bufUsed + 1, 0, 20);
	    }

	    if (en->cursorPosition == en->bufUsed) {
		en->bufUsed++;
	    } else {
		/* insert the new character */

		/* chptr is the last character in the string */
		chptr = (en->buf + en->bufUsed) - 1;
		if ((en->bufUsed + 1) == en->bufAlloced) {
		    /* this string fills the buffer, so clip it */
		    chptr--;
		} else
		    en->bufUsed++;

		insPoint = en->buf + en->cursorPosition;

		while (chptr >= insPoint) {
		    *(chptr + 1) = *chptr;
		    chptr--;
		}

	    }

	    en->buf[en->cursorPosition++] = key;
	} else {
	    er.result = ER_IGNORED;
	}
    }

    entryDraw(co);

    return er;
}

char * newtEntryGetValue(newtComponent co) {
    struct entry * en = co->data;

    return en->buf;
}

void newtEntrySetFilter(newtComponent co, newtEntryFilter filter, void * data) {
    struct entry * en = co->data;
    en->filter = filter;
    en->filterData = data;
}