* The shortcuts of the encodings shadowed other shortcuts, like Command-G to
switch Terminals. I've not only removed that shortcut, though, I disabled all encoding shortcuts, as I frankly don't see any use for them beyond confusing users (by accidently hitting one of the 134 shortcuts). * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29494 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d39c5354b8
commit
a41b1bcb3a
@ -1,6 +1,13 @@
|
||||
/*
|
||||
* Copyright 2003-2009 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*/
|
||||
|
||||
#include "Coding.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
struct etable {
|
||||
const char *name; // long name for menu item.
|
||||
const char *shortname; // short name (use for command-line etc.)
|
||||
@ -8,12 +15,10 @@ struct etable {
|
||||
const int32 id; // encoding id
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* encoding_table ... use encoding menu, message, and preference keys.
|
||||
*/
|
||||
const static etable kEncodingTable[] =
|
||||
{
|
||||
const static etable kEncodingTable[] = {
|
||||
{"UTF-8", "UTF8", 'U', M_UTF8},
|
||||
{"ISO-8859-1", "8859-1", '1', B_ISO1_CONVERSION},
|
||||
{"ISO-8859-2", "8859-2", '2', B_ISO2_CONVERSION},
|
||||
@ -30,7 +35,7 @@ const static etable kEncodingTable[] =
|
||||
{"Shift-JIS", "SJIS", 'S', B_SJIS_CONVERSION},
|
||||
{"EUC-jp", "EUCJ", 'E', B_EUC_CONVERSION},
|
||||
{"EUC-kr", "EUCK", 'K', B_EUC_KR_CONVERSION},
|
||||
{"GB18030", "GB18030", 'G', B_GBK_CONVERSION},
|
||||
{"GB18030", "GB18030", 0, B_GBK_CONVERSION},
|
||||
{"Big5", "Big5", 'B', B_BIG5_CONVERSION},
|
||||
|
||||
/* Not Implemented.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2005, Haiku, Inc.
|
||||
* Copyright (c) 2001-2009, Haiku, Inc.
|
||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||
* Distributed under the terms of the MIT license.
|
||||
@ -7,19 +7,21 @@
|
||||
* Authors:
|
||||
* Kian Duffy <myob@users.sourceforge.net>
|
||||
*/
|
||||
#include <Menu.h>
|
||||
#include <string.h>
|
||||
#include <MenuItem.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Font.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "MenuUtil.h"
|
||||
#include "TermConst.h"
|
||||
#include "PrefHandler.h"
|
||||
#include "Coding.h"
|
||||
|
||||
//#define LOCALE_FILE_DIR PREF_FOLDER"menu/"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Font.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuItem.h>
|
||||
#include <PopUpMenu.h>
|
||||
|
||||
#include "Coding.h"
|
||||
#include "PrefHandler.h"
|
||||
#include "TermConst.h"
|
||||
|
||||
|
||||
BPopUpMenu *
|
||||
MakeMenu(ulong msg, const char **items, const char *defaultItemName)
|
||||
@ -42,24 +44,25 @@ MakeMenu(ulong msg, const char **items, const char *defaultItemName)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
MakeEncodingMenu(BMenu *eMenu, bool flag)
|
||||
MakeEncodingMenu(BMenu *eMenu, bool withShortcuts)
|
||||
{
|
||||
int encoding;
|
||||
int i = 0;
|
||||
while (get_nth_encoding(i, &encoding) == B_OK) {
|
||||
BMessage *msg = new BMessage(MENU_ENCODING);
|
||||
msg->AddInt32("op", (int32)encoding);
|
||||
if (flag)
|
||||
eMenu->AddItem(new BMenuItem(EncodingAsString(encoding), msg, id2shortcut(encoding)));
|
||||
else
|
||||
if (withShortcuts) {
|
||||
eMenu->AddItem(new BMenuItem(EncodingAsString(encoding), msg,
|
||||
id2shortcut(encoding)));
|
||||
} else
|
||||
eMenu->AddItem(new BMenuItem(EncodingAsString(encoding), msg));
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LoadLocaleFile(PrefHandler *pref)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2005, Haiku, Inc.
|
||||
* Copyright (c) 2001-2009, Haiku, Inc.
|
||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||
* Distributed under the terms of the MIT license.
|
||||
@ -7,8 +7,8 @@
|
||||
* Authors:
|
||||
* Kian Duffy <myob@users.sourceforge.net>
|
||||
*/
|
||||
#ifndef MENUUTIL_H_INCLUDED
|
||||
#define MENUUTIL_H_INCLUDED
|
||||
#ifndef MENU_UTIL_H
|
||||
#define MENU_UTIL_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
@ -19,10 +19,7 @@ class PrefHandler;
|
||||
|
||||
BPopUpMenu* MakeMenu(ulong msg, const char** items,
|
||||
const char* defaultItemName);
|
||||
void MakeEncodingMenu(BMenu *eMenu, bool withShortcuts);
|
||||
void LoadLocaleFile(PrefHandler* handler);
|
||||
|
||||
void MakeEncodingMenu(BMenu *eMenu, bool flag);
|
||||
void LoadLocaleFile (PrefHandler *);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif // MENU_UTIL_H
|
||||
|
@ -295,10 +295,12 @@ TermApp::_SwitchTerm()
|
||||
bool
|
||||
TermApp::_IsSwitchTarget(team_id id)
|
||||
{
|
||||
uint32 currentWorkspace = 1L << current_workspace();
|
||||
|
||||
BMessenger app(TERM_SIGNATURE, id);
|
||||
if (app.IsTargetLocal()) {
|
||||
return !fTermWindow->IsMinimized()
|
||||
&& (fTermWindow->Workspaces() & (1L << current_workspace())) != 0;
|
||||
&& (fTermWindow->Workspaces() & currentWorkspace) != 0;
|
||||
}
|
||||
|
||||
BMessage reply;
|
||||
@ -311,13 +313,11 @@ TermApp::_IsSwitchTarget(team_id id)
|
||||
|| reply.FindInt32("workspaces", &workspaces) != B_OK)
|
||||
return false;
|
||||
|
||||
return !minimized
|
||||
&& (workspaces & (1L << current_workspace())) != 0;
|
||||
return !minimized && (workspaces & currentWorkspace) != 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Checks if all teams that have an ID-to-team mapping in the message
|
||||
/*! Checks if all teams that have an ID-to-team mapping in the message
|
||||
are still running.
|
||||
The IDs for teams that are gone will be made available again, and
|
||||
their mapping is removed from the message.
|
||||
|
@ -250,17 +250,22 @@ TermWindow::_SetupMenu()
|
||||
|
||||
// Make File Menu.
|
||||
fFilemenu = new BMenu("Terminal");
|
||||
fFilemenu->AddItem(new BMenuItem("Switch Terminals", new BMessage(MENU_SWITCH_TERM),'G'));
|
||||
fFilemenu->AddItem(new BMenuItem("New Terminal" B_UTF8_ELLIPSIS, new BMessage(MENU_NEW_TERM), 'N'));
|
||||
fFilemenu->AddItem(new BMenuItem("Switch Terminals",
|
||||
new BMessage(MENU_SWITCH_TERM),'G'));
|
||||
fFilemenu->AddItem(new BMenuItem("New Terminal" B_UTF8_ELLIPSIS,
|
||||
new BMessage(MENU_NEW_TERM), 'N'));
|
||||
fFilemenu->AddItem(new BMenuItem("New Tab", new BMessage(kNewTab), 'T'));
|
||||
|
||||
fFilemenu->AddSeparatorItem();
|
||||
fFilemenu->AddItem(new BMenuItem("Page Setup" B_UTF8_ELLIPSIS, new BMessage(MENU_PAGE_SETUP)));
|
||||
fFilemenu->AddItem(new BMenuItem("Page Setup" B_UTF8_ELLIPSIS,
|
||||
new BMessage(MENU_PAGE_SETUP)));
|
||||
fFilemenu->AddItem(new BMenuItem("Print", new BMessage(MENU_PRINT),'P'));
|
||||
fFilemenu->AddSeparatorItem();
|
||||
fFilemenu->AddItem(new BMenuItem("About Terminal" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED)));
|
||||
fFilemenu->AddItem(new BMenuItem("About Terminal" B_UTF8_ELLIPSIS,
|
||||
new BMessage(B_ABOUT_REQUESTED)));
|
||||
fFilemenu->AddSeparatorItem();
|
||||
fFilemenu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q'));
|
||||
fFilemenu->AddItem(new BMenuItem("Quit",
|
||||
new BMessage(B_QUIT_REQUESTED), 'Q'));
|
||||
fMenubar->AddItem(fFilemenu);
|
||||
|
||||
// Make Edit Menu.
|
||||
@ -268,14 +273,19 @@ TermWindow::_SetupMenu()
|
||||
fEditmenu->AddItem(new BMenuItem("Copy", new BMessage(B_COPY),'C'));
|
||||
fEditmenu->AddItem(new BMenuItem("Paste", new BMessage(B_PASTE),'V'));
|
||||
fEditmenu->AddSeparatorItem();
|
||||
fEditmenu->AddItem (new BMenuItem ("Select All", new BMessage (B_SELECT_ALL), 'A'));
|
||||
fEditmenu->AddItem (new BMenuItem ("Clear All", new BMessage (MENU_CLEAR_ALL), 'L'));
|
||||
fEditmenu->AddItem(new BMenuItem("Select All",
|
||||
new BMessage(B_SELECT_ALL), 'A'));
|
||||
fEditmenu->AddItem(new BMenuItem("Clear All",
|
||||
new BMessage(MENU_CLEAR_ALL), 'L'));
|
||||
fEditmenu->AddSeparatorItem();
|
||||
fEditmenu->AddItem (new BMenuItem ("Find" B_UTF8_ELLIPSIS, new BMessage (MENU_FIND_STRING),'F'));
|
||||
fFindBackwardMenuItem = new BMenuItem ("Find Backward", new BMessage (MENU_FIND_BACKWARD), '[');
|
||||
fEditmenu->AddItem(new BMenuItem("Find" B_UTF8_ELLIPSIS,
|
||||
new BMessage(MENU_FIND_STRING),'F'));
|
||||
fFindBackwardMenuItem = new BMenuItem("Find Backward",
|
||||
new BMessage(MENU_FIND_BACKWARD), '[');
|
||||
fEditmenu->AddItem(fFindBackwardMenuItem);
|
||||
fFindBackwardMenuItem->SetEnabled(false);
|
||||
fFindForwardMenuItem = new BMenuItem ("Find Forward", new BMessage (MENU_FIND_FORWARD), ']');
|
||||
fFindForwardMenuItem = new BMenuItem("Find Forward",
|
||||
new BMessage(MENU_FIND_FORWARD), ']');
|
||||
fEditmenu->AddItem(fFindForwardMenuItem);
|
||||
fFindForwardMenuItem->SetEnabled(false);
|
||||
|
||||
@ -288,13 +298,15 @@ TermWindow::_SetupMenu()
|
||||
|
||||
fEncodingmenu = new BMenu("Text Encoding");
|
||||
fEncodingmenu->SetRadioMode(true);
|
||||
MakeEncodingMenu(fEncodingmenu, true);
|
||||
MakeEncodingMenu(fEncodingmenu, false);
|
||||
fHelpmenu->AddItem(fWindowSizeMenu);
|
||||
fHelpmenu->AddItem(fEncodingmenu);
|
||||
fHelpmenu->AddSeparatorItem();
|
||||
fHelpmenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS, new BMessage(MENU_PREF_OPEN)));
|
||||
fHelpmenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS,
|
||||
new BMessage(MENU_PREF_OPEN)));
|
||||
fHelpmenu->AddSeparatorItem();
|
||||
fHelpmenu->AddItem(new BMenuItem("Save as default", new BMessage(SAVE_AS_DEFAULT)));
|
||||
fHelpmenu->AddItem(new BMenuItem("Save as default",
|
||||
new BMessage(SAVE_AS_DEFAULT)));
|
||||
fMenubar->AddItem(fHelpmenu);
|
||||
|
||||
AddChild(fMenubar);
|
||||
|
Loading…
Reference in New Issue
Block a user