display loaded language code when using keyb without parameter
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3239
This commit is contained in:
parent
5de6a70750
commit
5822f7af76
2 changed files with 30 additions and 4 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_keyboard_layout.cpp,v 1.15 2008-10-30 22:34:17 c2woody Exp $ */
|
||||
/* $Id: dos_keyboard_layout.cpp,v 1.16 2008-11-22 14:24:11 c2woody Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "bios.h"
|
||||
|
@ -81,6 +81,7 @@ public:
|
|||
|
||||
Bitu switch_keyboard_layout(const char* new_layout, keyboard_layout* &created_layout);
|
||||
void switch_foreign_layout();
|
||||
const char* get_layout_name();
|
||||
|
||||
|
||||
private:
|
||||
|
@ -993,6 +994,16 @@ void keyboard_layout::switch_foreign_layout() {
|
|||
else LOG(LOG_BIOS,LOG_NORMAL)("Switched to US layout");
|
||||
}
|
||||
|
||||
const char* keyboard_layout::get_layout_name() {
|
||||
// get layout name (language ID or NULL if default layout)
|
||||
if (use_foreign_layout) {
|
||||
if (strcmp(current_keyboard_file_name,"none") != 0) {
|
||||
return (const char*)¤t_keyboard_file_name;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static keyboard_layout* loaded_layout=NULL;
|
||||
|
||||
|
@ -1041,6 +1052,14 @@ Bitu DOS_SwitchKeyboardLayout(const char* new_layout) {
|
|||
} else return 0xff;
|
||||
}
|
||||
|
||||
// get currently loaded layout name (NULL if no layout is loaded)
|
||||
const char* DOS_GetLoadedLayout(void) {
|
||||
if (loaded_layout) {
|
||||
return loaded_layout->get_layout_name();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
class DOS_KeyboardLayout: public Module_base {
|
||||
public:
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_programs.cpp,v 1.89 2008-11-06 19:31:21 c2woody Exp $ */
|
||||
/* $Id: dos_programs.cpp,v 1.90 2008-11-22 14:24:11 c2woody Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
#include <stdlib.h>
|
||||
|
@ -1292,6 +1292,7 @@ void IMGMOUNT_ProgramStart(Program * * make) {
|
|||
|
||||
Bitu DOS_SwitchKeyboardLayout(const char* new_layout);
|
||||
Bitu DOS_LoadKeyboardLayout(const char * layoutname, Bit32s codepage, const char * codepagefile);
|
||||
const char* DOS_GetLoadedLayout(void);
|
||||
|
||||
class KEYB : public Program {
|
||||
public:
|
||||
|
@ -1344,8 +1345,13 @@ void KEYB::Run(void) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
/* no parameter in the command line, just output codepage info */
|
||||
WriteOut(MSG_Get("PROGRAM_KEYB_INFO"),dos.loaded_codepage);
|
||||
/* no parameter in the command line, just output codepage info and possibly loaded layout ID */
|
||||
const char* layout_name = DOS_GetLoadedLayout();
|
||||
if (layout_name==NULL) {
|
||||
WriteOut(MSG_Get("PROGRAM_KEYB_INFO"),dos.loaded_codepage);
|
||||
} else {
|
||||
WriteOut(MSG_Get("PROGRAM_KEYB_INFO_LAYOUT"),dos.loaded_codepage,layout_name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1532,6 +1538,7 @@ void DOS_SetupPrograms(void) {
|
|||
MSG_Add("PROGRAM_IMGMOUNT_MULTIPLE_NON_CUEISO_FILES", "Using multiple files is only supported for cue/iso images.\n");
|
||||
|
||||
MSG_Add("PROGRAM_KEYB_INFO","Codepage %i has been loaded\n");
|
||||
MSG_Add("PROGRAM_KEYB_INFO_LAYOUT","Codepage %i has been loaded for layout %s\n");
|
||||
MSG_Add("PROGRAM_KEYB_SHOWHELP",
|
||||
"\033[32;1mKEYB\033[0m [keyboard layout ID[ codepage number[ codepage file]]]\n\n"
|
||||
"Some examples:\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue