Automatic whitespace cleanup. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43002 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -30,19 +30,19 @@ void
|
|||||||
CannaInterface::InitializeCanna()
|
CannaInterface::InitializeCanna()
|
||||||
{
|
{
|
||||||
char **warn;
|
char **warn;
|
||||||
|
|
||||||
context_id = 0; //context id is now fixed to zero.
|
context_id = 0; //context id is now fixed to zero.
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface:Setting basepath to %s.\n", basePath ));
|
SERIAL_PRINT(( "CannaInterface:Setting basepath to %s.\n", basePath ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setBasePath( basePath );
|
setBasePath( basePath );
|
||||||
|
|
||||||
jrKanjiControl(context_id, KC_INITIALIZE, (char *)&warn);
|
jrKanjiControl(context_id, KC_INITIALIZE, (char *)&warn);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface:Canna Initialize result = %x.\n", warn ));
|
SERIAL_PRINT(( "CannaInterface:Canna Initialize result = %x.\n", warn ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (warn)
|
if (warn)
|
||||||
{
|
{
|
||||||
canna_enabled = false;
|
canna_enabled = false;
|
||||||
@@ -55,12 +55,12 @@ CannaInterface::InitializeCanna()
|
|||||||
jrKanjiControl( context_id, KC_SETMODEINFOSTYLE, (char *)(int32) 0);
|
jrKanjiControl( context_id, KC_SETMODEINFOSTYLE, (char *)(int32) 0);
|
||||||
|
|
||||||
jrKanjiControl(context_id, KC_SETHEXINPUTSTYLE, (char *)(int32) 1);
|
jrKanjiControl(context_id, KC_SETHEXINPUTSTYLE, (char *)(int32) 1);
|
||||||
|
|
||||||
jrKanjiControl( context_id, KC_SETUNDEFKEYFUNCTION, (char *)(int32) kc_through );
|
jrKanjiControl( context_id, KC_SETUNDEFKEYFUNCTION, (char *)(int32) kc_through );
|
||||||
|
|
||||||
jrKanjiStatusWithValue ks;
|
jrKanjiStatusWithValue ks;
|
||||||
uchar buf[CONVERT_BUFFER_SIZE];
|
uchar buf[CONVERT_BUFFER_SIZE];
|
||||||
|
|
||||||
ks.val = CANNA_MODE_HenkanMode;
|
ks.val = CANNA_MODE_HenkanMode;
|
||||||
ks.buffer = buf;
|
ks.buffer = buf;
|
||||||
ks.bytes_buffer = CONVERT_BUFFER_SIZE;
|
ks.bytes_buffer = CONVERT_BUFFER_SIZE;
|
||||||
@@ -104,10 +104,10 @@ status_t CannaInterface::InitCheck()
|
|||||||
uint32 CannaInterface::KeyIn( char ch, uint32 mod, int32 key )
|
uint32 CannaInterface::KeyIn( char ch, uint32 mod, int32 key )
|
||||||
{
|
{
|
||||||
int inkey;
|
int inkey;
|
||||||
|
|
||||||
inkey = ConvertSpecial( ch, mod, key );
|
inkey = ConvertSpecial( ch, mod, key );
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x%x\n", inkey ));
|
SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x%x\n", inkey ));
|
||||||
#endif
|
#endif
|
||||||
if ( convert_arrowkey && kanji_status.gline.length != 0 )
|
if ( convert_arrowkey && kanji_status.gline.length != 0 )
|
||||||
inkey = ConvertArrowKey( inkey );
|
inkey = ConvertArrowKey( inkey );
|
||||||
@@ -122,18 +122,18 @@ SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x
|
|||||||
strcpy( previousUTF, mikakuteiUTF );
|
strcpy( previousUTF, mikakuteiUTF );
|
||||||
hadMikakuteiStr = true;
|
hadMikakuteiStr = true;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: Calling jrKanjiString()...\n" ));
|
SERIAL_PRINT(( "CannaInterface: Calling jrKanjiString()...\n" ));
|
||||||
#endif
|
#endif
|
||||||
kakuteiLen = jrKanjiString(context_id, inkey, kakuteiStr, CONVERT_BUFFER_SIZE, &kanji_status);
|
kakuteiLen = jrKanjiString(context_id, inkey, kakuteiStr, CONVERT_BUFFER_SIZE, &kanji_status);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "kakL = %d, mikL = %d, glineL = %d, info = 0x%x\n", kakuteiLen, kanji_status.length, kanji_status.gline.length, kanji_status.info ));
|
SERIAL_PRINT(( "kakL = %d, mikL = %d, glineL = %d, info = 0x%x\n", kakuteiLen, kanji_status.length, kanji_status.gline.length, kanji_status.info ));
|
||||||
#endif
|
#endif
|
||||||
//return UpdateKanjiStatus();
|
//return UpdateKanjiStatus();
|
||||||
uint32 result = UpdateKanjiStatus();
|
uint32 result = UpdateKanjiStatus();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: KeyIn() returning 0x%x.\n", result ));
|
SERIAL_PRINT(( "CannaInterface: KeyIn() returning 0x%x.\n", result ));
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ uint32 CannaInterface::UpdateKanjiStatus()
|
|||||||
{
|
{
|
||||||
uint32 result = 0;
|
uint32 result = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" ));
|
SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( hadGuideLine && kanji_status.gline.length == 0 )
|
if ( hadGuideLine && kanji_status.gline.length == 0 )
|
||||||
@@ -150,13 +150,13 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" ));
|
|||||||
result |= GUIDELINE_DISAPPEARED;
|
result |= GUIDELINE_DISAPPEARED;
|
||||||
hadGuideLine = false;
|
hadGuideLine = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( kanji_status.length == -1 )
|
if ( kanji_status.length == -1 )
|
||||||
{
|
{
|
||||||
result |= MIKAKUTEI_NO_CHANGE;
|
result |= MIKAKUTEI_NO_CHANGE;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( kanji_status.info & KanjiThroughInfo )
|
if ( kanji_status.info & KanjiThroughInfo )
|
||||||
{
|
{
|
||||||
result |= THROUGH_INPUT;
|
result |= THROUGH_INPUT;
|
||||||
@@ -172,7 +172,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" ));
|
|||||||
jrKanjiControl( context_id, KC_SETMODEINFOSTYLE, (char *)(int32) 0);
|
jrKanjiControl( context_id, KC_SETMODEINFOSTYLE, (char *)(int32) 0);
|
||||||
result |= MODE_CHANGED;
|
result |= MODE_CHANGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !hadMikakuteiStr && (kanji_status.length != 0 || kakuteiLen != 0 ))
|
if ( !hadMikakuteiStr && (kanji_status.length != 0 || kakuteiLen != 0 ))
|
||||||
{
|
{
|
||||||
//ClearPrevious();
|
//ClearPrevious();
|
||||||
@@ -207,7 +207,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" ));
|
|||||||
|
|
||||||
result |= MIKAKUTEI_EXISTS;
|
result |= MIKAKUTEI_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//when mikakutei string is deleted and become empty
|
//when mikakutei string is deleted and become empty
|
||||||
if ( hadMikakuteiStr && kanji_status.length == 0 && kakuteiLen == 0 )
|
if ( hadMikakuteiStr && kanji_status.length == 0 && kakuteiLen == 0 )
|
||||||
result |= MIKAKUTEI_BECOME_EMPTY;
|
result |= MIKAKUTEI_BECOME_EMPTY;
|
||||||
@@ -219,13 +219,13 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" ));
|
|||||||
|
|
||||||
if ( hadGuideLine && (kanji_status.info & KanjiGLineInfo) )
|
if ( hadGuideLine && (kanji_status.info & KanjiGLineInfo) )
|
||||||
result |= GUIDELINE_CHANGED;
|
result |= GUIDELINE_CHANGED;
|
||||||
|
|
||||||
if ( !hadGuideLine && kanji_status.gline.length != 0 )
|
if ( !hadGuideLine && kanji_status.gline.length != 0 )
|
||||||
{
|
{
|
||||||
result |= GUIDELINE_APPEARED;
|
result |= GUIDELINE_APPEARED;
|
||||||
hadGuideLine = true;
|
hadGuideLine = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate revpos, revlen
|
// calculate revpos, revlen
|
||||||
if ( kanji_status.revLen == 0 )
|
if ( kanji_status.revLen == 0 )
|
||||||
{
|
{
|
||||||
@@ -239,7 +239,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" ));
|
|||||||
convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.echoStr, &length,
|
convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.echoStr, &length,
|
||||||
mikakuteiUTF, &revBegin, &state );
|
mikakuteiUTF, &revBegin, &state );
|
||||||
revBegin += kakuteiUTFLen;
|
revBegin += kakuteiUTFLen;
|
||||||
|
|
||||||
length = kanji_status.revPos + kanji_status.revLen;
|
length = kanji_status.revPos + kanji_status.revLen;
|
||||||
revEnd = CONVERT_BUFFER_SIZE * 2;
|
revEnd = CONVERT_BUFFER_SIZE * 2;
|
||||||
convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.echoStr, &length,
|
convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.echoStr, &length,
|
||||||
@@ -247,7 +247,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" ));
|
|||||||
revEnd += kakuteiUTFLen;
|
revEnd += kakuteiUTFLen;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: UpdateKanjiStatus() returning 0x%x.\n", result ));
|
SERIAL_PRINT(( "CannaInterface: UpdateKanjiStatus() returning 0x%x.\n", result ));
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@ int
|
|||||||
CannaInterface::ConvertSpecial(char ch, uint32 mod, int32 key)
|
CannaInterface::ConvertSpecial(char ch, uint32 mod, int32 key)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: ConvertSpecial ch = 0x%x, mod = 0x%x, key = 0x%x\n", ch, mod, key ));
|
SERIAL_PRINT(( "CannaInterface: ConvertSpecial ch = 0x%x, mod = 0x%x, key = 0x%x\n", ch, mod, key ));
|
||||||
#endif
|
#endif
|
||||||
if (mod & B_CONTROL_KEY) {
|
if (mod & B_CONTROL_KEY) {
|
||||||
// if control key is held down, do not convert special key
|
// if control key is held down, do not convert special key
|
||||||
@@ -372,7 +372,7 @@ void CannaInterface::GetModified( int32* from, int32* to, char** string )
|
|||||||
{
|
{
|
||||||
int32 i, previousLen;
|
int32 i, previousLen;
|
||||||
previousLen = strlen( previousUTF );
|
previousLen = strlen( previousUTF );
|
||||||
|
|
||||||
for( i = 0 ;
|
for( i = 0 ;
|
||||||
mikakuteiUTF[i] == previousUTF[i]
|
mikakuteiUTF[i] == previousUTF[i]
|
||||||
&& mikakuteiUTF[i] != '\0'
|
&& mikakuteiUTF[i] != '\0'
|
||||||
@@ -380,12 +380,12 @@ void CannaInterface::GetModified( int32* from, int32* to, char** string )
|
|||||||
i++ ) {}
|
i++ ) {}
|
||||||
|
|
||||||
*from = i;
|
*from = i;
|
||||||
|
|
||||||
if ( mikakuteiUTFLen > previousLen )
|
if ( mikakuteiUTFLen > previousLen )
|
||||||
*to = mikakuteiUTFLen;
|
*to = mikakuteiUTFLen;
|
||||||
else
|
else
|
||||||
*to = previousLen;
|
*to = previousLen;
|
||||||
|
|
||||||
*string = &mikakuteiUTF[ i ];
|
*string = &mikakuteiUTF[ i ];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ int32 CannaInterface::ForceKakutei()
|
|||||||
{
|
{
|
||||||
if ( !canna_enabled )
|
if ( !canna_enabled )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
jrKanjiStatusWithValue ks;
|
jrKanjiStatusWithValue ks;
|
||||||
ks.val = 0;
|
ks.val = 0;
|
||||||
ks.buffer = (unsigned char *)kakuteiStr;
|
ks.buffer = (unsigned char *)kakuteiStr;
|
||||||
@@ -409,14 +409,14 @@ bool CannaInterface::ReadSetting(char *path, BFont *aFont)
|
|||||||
BFile preffile( INLINE_SETTING_FILE, B_READ_ONLY );
|
BFile preffile( INLINE_SETTING_FILE, B_READ_ONLY );
|
||||||
if ( preffile.InitCheck() != B_NO_ERROR )
|
if ( preffile.InitCheck() != B_NO_ERROR )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( pref.Unflatten( &preffile ) != B_OK )
|
if ( pref.Unflatten( &preffile ) != B_OK )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
font_family fontfamily;
|
font_family fontfamily;
|
||||||
float size;
|
float size;
|
||||||
char *string;
|
char *string;
|
||||||
|
|
||||||
underline_color = FindColorData( &pref, "underline" );
|
underline_color = FindColorData( &pref, "underline" );
|
||||||
highlight_color = FindColorData( &pref, "highlight" );
|
highlight_color = FindColorData( &pref, "highlight" );
|
||||||
selection_color = FindColorData( &pref, "selection" );
|
selection_color = FindColorData( &pref, "selection" );
|
||||||
@@ -427,7 +427,7 @@ bool CannaInterface::ReadSetting(char *path, BFont *aFont)
|
|||||||
pref.FindFloat( "size", &size );
|
pref.FindFloat( "size", &size );
|
||||||
pref.FindBool( "arrow", &convert_arrowkey );
|
pref.FindBool( "arrow", &convert_arrowkey );
|
||||||
|
|
||||||
aFont->SetFamilyAndStyle( fontfamily, NULL );
|
aFont->SetFamilyAndStyle( fontfamily, NULL );
|
||||||
aFont->SetSize( size );
|
aFont->SetSize( size );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -442,7 +442,7 @@ rgb_color CannaInterface::FindColorData( BMessage *msg, char *name )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool CannaInterface::HasRev()
|
bool CannaInterface::HasRev()
|
||||||
{
|
{
|
||||||
if ( kanji_status.revLen == 0 )
|
if ( kanji_status.revLen == 0 )
|
||||||
@@ -462,17 +462,17 @@ CannaInterface::GenerateKouhoString()
|
|||||||
int32 state;
|
int32 state;
|
||||||
bool noindex, sizelimit, partialhighlight;
|
bool noindex, sizelimit, partialhighlight;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mode = %d\n", revposition, kanji_status.gline.revLen, current_mode ));
|
SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mode = %d\n", revposition, kanji_status.gline.revLen, current_mode ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
noindex = sizelimit = partialhighlight = false;
|
noindex = sizelimit = partialhighlight = false;
|
||||||
|
|
||||||
kouhoUTFLen = KOUHO_WINDOW_MAXCHAR * 2;
|
kouhoUTFLen = KOUHO_WINDOW_MAXCHAR * 2;
|
||||||
convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.gline.line, &length,
|
convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.gline.line, &length,
|
||||||
kouhoUTF, &kouhoUTFLen, &state );
|
kouhoUTF, &kouhoUTFLen, &state );
|
||||||
kouhoUTF[ kouhoUTFLen ] = '\0';
|
kouhoUTF[ kouhoUTFLen ] = '\0';
|
||||||
|
|
||||||
|
|
||||||
//find gline revpos by converting to UTF8
|
//find gline revpos by converting to UTF8
|
||||||
if ( kanji_status.gline.revLen == 0 )
|
if ( kanji_status.gline.revLen == 0 )
|
||||||
kouhoRevLine = -1;
|
kouhoRevLine = -1;
|
||||||
@@ -483,8 +483,8 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod
|
|||||||
kouhoUTF, &revposUTF, &state );
|
kouhoUTF, &revposUTF, &state );
|
||||||
//then, count full-spaces before revpos
|
//then, count full-spaces before revpos
|
||||||
kouhoRevLine = 0;
|
kouhoRevLine = 0;
|
||||||
|
|
||||||
if ( current_mode == CANNA_MODE_TourokuMode
|
if ( current_mode == CANNA_MODE_TourokuMode
|
||||||
|| ( kanji_status.gline.length != 0 && current_mode != CANNA_MODE_KigoMode
|
|| ( kanji_status.gline.length != 0 && current_mode != CANNA_MODE_KigoMode
|
||||||
&& current_mode != CANNA_MODE_IchiranMode
|
&& current_mode != CANNA_MODE_IchiranMode
|
||||||
&& current_mode != CANNA_MODE_YesNoMode
|
&& current_mode != CANNA_MODE_YesNoMode
|
||||||
@@ -511,7 +511,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod
|
|||||||
{
|
{
|
||||||
for ( long i = 0; i < revposUTF ; i++ )
|
for ( long i = 0; i < revposUTF ; i++ )
|
||||||
{
|
{
|
||||||
if ( (uint8)kouhoUTF[ i ] == 0xe3
|
if ( (uint8)kouhoUTF[ i ] == 0xe3
|
||||||
&& (uint8)kouhoUTF[ i + 1 ] == 0x80
|
&& (uint8)kouhoUTF[ i + 1 ] == 0x80
|
||||||
&& (uint8)kouhoUTF[ i + 2 ] == 0x80 )
|
&& (uint8)kouhoUTF[ i + 2 ] == 0x80 )
|
||||||
kouhoRevLine++;
|
kouhoRevLine++;
|
||||||
@@ -520,7 +520,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod
|
|||||||
|
|
||||||
}
|
}
|
||||||
//printf("KouhoRevLine = %d\n", kouhoRevLine );
|
//printf("KouhoRevLine = %d\n", kouhoRevLine );
|
||||||
|
|
||||||
// setup title string
|
// setup title string
|
||||||
switch ( current_mode )
|
switch ( current_mode )
|
||||||
{
|
{
|
||||||
@@ -588,7 +588,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod
|
|||||||
//setup info string according to current mode
|
//setup info string according to current mode
|
||||||
char* index;
|
char* index;
|
||||||
int32 len;
|
int32 len;
|
||||||
|
|
||||||
if (current_mode == CANNA_MODE_IchiranMode
|
if (current_mode == CANNA_MODE_IchiranMode
|
||||||
|| current_mode == CANNA_MODE_ExtendMode
|
|| current_mode == CANNA_MODE_ExtendMode
|
||||||
|| (current_mode == CANNA_MODE_TourokuHinshiMode
|
|| (current_mode == CANNA_MODE_TourokuHinshiMode
|
||||||
@@ -632,7 +632,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod
|
|||||||
kouhoUTFLen = strlen(kouhoUTF);
|
kouhoUTFLen = strlen(kouhoUTF);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if ( current_mode == CANNA_MODE_TourokuMode
|
if ( current_mode == CANNA_MODE_TourokuMode
|
||||||
|| ( kanji_status.gline.length != 0 && ( current_mode == CANNA_MODE_TankouhoMode
|
|| ( kanji_status.gline.length != 0 && ( current_mode == CANNA_MODE_TankouhoMode
|
||||||
|| current_mode == CANNA_MODE_TankouhoMode
|
|| current_mode == CANNA_MODE_TankouhoMode
|
||||||
|| current_mode == CANNA_MODE_AdjustBunsetsuMode )))
|
|| current_mode == CANNA_MODE_AdjustBunsetsuMode )))
|
||||||
@@ -644,7 +644,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod
|
|||||||
*index = '\x0a';
|
*index = '\x0a';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if ( current_mode == CANNA_MODE_IchiranMode
|
if ( current_mode == CANNA_MODE_IchiranMode
|
||||||
|| current_mode == CANNA_MODE_RussianMode
|
|| current_mode == CANNA_MODE_RussianMode
|
||||||
|| current_mode == CANNA_MODE_LineMode
|
|| current_mode == CANNA_MODE_LineMode
|
||||||
@@ -662,7 +662,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod
|
|||||||
while ( ( *index >= '0' && *index <= '9' ) || *index == '/' )
|
while ( ( *index >= '0' && *index <= '9' ) || *index == '/' )
|
||||||
index--;
|
index--;
|
||||||
strcat( infoUTF, index );
|
strcat( infoUTF, index );
|
||||||
|
|
||||||
//remove excess spaces before number display
|
//remove excess spaces before number display
|
||||||
while ( *index == ' ' )
|
while ( *index == ' ' )
|
||||||
*index-- = '\0';
|
*index-- = '\0';
|
||||||
@@ -690,14 +690,14 @@ uint32 CannaInterface::ChangeMode( int32 mode )
|
|||||||
ksv.buffer = (unsigned char *)kakuteiStr;
|
ksv.buffer = (unsigned char *)kakuteiStr;
|
||||||
ksv.bytes_buffer = CONVERT_BUFFER_SIZE;
|
ksv.bytes_buffer = CONVERT_BUFFER_SIZE;
|
||||||
ksv.val = mode;
|
ksv.val = mode;
|
||||||
|
|
||||||
jrKanjiControl( context_id, KC_CHANGEMODE, (char *)&ksv );
|
jrKanjiControl( context_id, KC_CHANGEMODE, (char *)&ksv );
|
||||||
kakuteiLen = ksv.val;
|
kakuteiLen = ksv.val;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: ChangeMode returned kakuteiLen = %d\n", kakuteiLen ));
|
SERIAL_PRINT(( "CannaInterface: ChangeMode returned kakuteiLen = %d\n", kakuteiLen ));
|
||||||
SERIAL_PRINT(( "CannaInterface: ChangeMode mikakuteiLen = %d\n", kanji_status.length ));
|
SERIAL_PRINT(( "CannaInterface: ChangeMode mikakuteiLen = %d\n", kanji_status.length ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return UpdateKanjiStatus();
|
return UpdateKanjiStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,7 +712,7 @@ uint32 CannaInterface::Kakutei()
|
|||||||
ksv.ks = &kanji_status;
|
ksv.ks = &kanji_status;
|
||||||
ksv.buffer = (unsigned char *)kakuteiStr;
|
ksv.buffer = (unsigned char *)kakuteiStr;
|
||||||
ksv.bytes_buffer = CONVERT_BUFFER_SIZE;
|
ksv.bytes_buffer = CONVERT_BUFFER_SIZE;
|
||||||
|
|
||||||
jrKanjiControl( context_id, KC_KAKUTEI, (char *)&ksv );
|
jrKanjiControl( context_id, KC_KAKUTEI, (char *)&ksv );
|
||||||
kakuteiLen = ksv.val;
|
kakuteiLen = ksv.val;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -751,13 +751,13 @@ CannaInterface::GetRevStartPositionInChar()
|
|||||||
{
|
{
|
||||||
int32 charNum;
|
int32 charNum;
|
||||||
charNum = 0;
|
charNum = 0;
|
||||||
|
|
||||||
if ( mikakuteiUTFLen == 0 )
|
if ( mikakuteiUTFLen == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "CannaInterface: GetRevStartPos revBegin = %d\n", revBegin ));
|
SERIAL_PRINT(( "CannaInterface: GetRevStartPos revBegin = %d\n", revBegin ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for ( int32 i = 0 ; i < mikakuteiUTFLen ; i += UTF8CharLen( mikakuteiUTF[i] ) )
|
for ( int32 i = 0 ; i < mikakuteiUTFLen ; i += UTF8CharLen( mikakuteiUTF[i] ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ private:
|
|||||||
uint32 UpdateKanjiStatus();
|
uint32 UpdateKanjiStatus();
|
||||||
void InitializeCanna();
|
void InitializeCanna();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CannaInterface( char *basepath );
|
CannaInterface( char *basepath );
|
||||||
~CannaInterface();
|
~CannaInterface();
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ CannaLooper::MessageReceived(BMessage* msg)
|
|||||||
panel->Go();
|
panel->Go();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case RELOAD_INIT_FILE:
|
case RELOAD_INIT_FILE:
|
||||||
_ForceKakutei();
|
_ForceKakutei();
|
||||||
fCanna->Reset();
|
fCanna->Reset();
|
||||||
@@ -425,7 +425,7 @@ CannaLooper::_HandleMethodActivated(bool active)
|
|||||||
{
|
{
|
||||||
if (active) {
|
if (active) {
|
||||||
if (!fPaletteWindow) {
|
if (!fPaletteWindow) {
|
||||||
// first time input method activated
|
// first time input method activated
|
||||||
float x = gSettings.palette_loc.x;
|
float x = gSettings.palette_loc.x;
|
||||||
float y = gSettings.palette_loc.y;
|
float y = gSettings.palette_loc.y;
|
||||||
BRect frame(x, y, x + 114, y + 44);
|
BRect frame(x, y, x + 114, y + 44);
|
||||||
@@ -448,8 +448,8 @@ CannaLooper::_HandleMethodActivated(bool active)
|
|||||||
fOwner->SetMenu(NULL, this);
|
fOwner->SetMenu(NULL, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CannaLooper::_ForceKakutei()
|
CannaLooper::_ForceKakutei()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CannaIM - Canna-based Input Method Add-on for BeOS R4
|
// CannaIM - Canna-based Input Method Add-on for BeOS R4
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <Looper.h>
|
#include <Looper.h>
|
||||||
@@ -61,12 +61,12 @@ status_t
|
|||||||
CannaMethod::MethodActivated( bool active )
|
CannaMethod::MethodActivated( bool active )
|
||||||
{
|
{
|
||||||
BMessage msg( CANNA_METHOD_ACTIVATED );
|
BMessage msg( CANNA_METHOD_ACTIVATED );
|
||||||
|
|
||||||
if ( active )
|
if ( active )
|
||||||
msg.AddBool( "active", true );
|
msg.AddBool( "active", true );
|
||||||
|
|
||||||
cannaLooper.SendMessage( &msg );
|
cannaLooper.SendMessage( &msg );
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ CannaMethod::Filter( BMessage *msg, BList *outList )
|
|||||||
{
|
{
|
||||||
if ( msg->what != B_KEY_DOWN )
|
if ( msg->what != B_KEY_DOWN )
|
||||||
return B_DISPATCH_MESSAGE;
|
return B_DISPATCH_MESSAGE;
|
||||||
|
|
||||||
cannaLooper.SendMessage( msg );
|
cannaLooper.SendMessage( msg );
|
||||||
return B_SKIP_MESSAGE;
|
return B_SKIP_MESSAGE;
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ CannaMethod::InitCheck()
|
|||||||
else
|
else
|
||||||
SERIAL_PRINT(( "CannaLooper::InitCheck() success.\n" ));
|
SERIAL_PRINT(( "CannaLooper::InitCheck() success.\n" ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ void CannaMethod::WriteSettings()
|
|||||||
BMessage pref;
|
BMessage pref;
|
||||||
BFile preffile( CANNAIM_SETTINGS_FILE,
|
BFile preffile( CANNAIM_SETTINGS_FILE,
|
||||||
B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE );
|
B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE );
|
||||||
|
|
||||||
if ( preffile.InitCheck() == B_NO_ERROR )
|
if ( preffile.InitCheck() == B_NO_ERROR )
|
||||||
{
|
{
|
||||||
pref.AddBool( "arrowkey", gSettings.convert_arrowkey );
|
pref.AddBool( "arrowkey", gSettings.convert_arrowkey );
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CannaIM - Canna-based Input Method Add-on for BeOS R4
|
// CannaIM - Canna-based Input Method Add-on for BeOS R4
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef _CANNAMETHOD_H
|
#ifndef _CANNAMETHOD_H
|
||||||
#define _CANNAMETHOD_H
|
#define _CANNAMETHOD_H
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
KouhoWindow::KouhoWindow( BFont *font, BLooper *looper )
|
KouhoWindow::KouhoWindow( BFont *font, BLooper *looper )
|
||||||
:BWindow( DUMMY_RECT,
|
:BWindow( DUMMY_RECT,
|
||||||
"kouho", B_MODAL_WINDOW_LOOK,
|
"kouho", B_MODAL_WINDOW_LOOK,
|
||||||
B_FLOATING_ALL_WINDOW_FEEL,
|
B_FLOATING_ALL_WINDOW_FEEL,
|
||||||
B_NOT_RESIZABLE | B_NOT_CLOSABLE |
|
B_NOT_RESIZABLE | B_NOT_CLOSABLE |
|
||||||
B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AVOID_FOCUS |
|
B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AVOID_FOCUS |
|
||||||
@@ -38,15 +38,15 @@ KouhoWindow::KouhoWindow( BFont *font, BLooper *looper )
|
|||||||
strcpy( style, "Regular" );
|
strcpy( style, "Regular" );
|
||||||
indexfont.SetFamilyAndStyle( family, style );
|
indexfont.SetFamilyAndStyle( family, style );
|
||||||
indexfont.SetSize( 10 );
|
indexfont.SetSize( 10 );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" ));
|
SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//setup main pane
|
//setup main pane
|
||||||
indexWidth = indexfont.StringWidth( "W" ) + INDEXVIEW_SIDE_MARGIN * 2;
|
indexWidth = indexfont.StringWidth( "W" ) + INDEXVIEW_SIDE_MARGIN * 2;
|
||||||
minimumWidth = indexfont.StringWidth( "ギリシャ 100/100" );
|
minimumWidth = indexfont.StringWidth( "ギリシャ 100/100" );
|
||||||
|
|
||||||
frame = Bounds();
|
frame = Bounds();
|
||||||
frame.left = indexWidth + 2;
|
frame.left = indexWidth + 2;
|
||||||
frame.bottom -= INFOVIEW_HEIGHT;
|
frame.bottom -= INFOVIEW_HEIGHT;
|
||||||
@@ -64,7 +64,7 @@ SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" ));
|
|||||||
indexView = new KouhoIndexView( frame, fontHeight );
|
indexView = new KouhoIndexView( frame, fontHeight );
|
||||||
indexView->SetFont( &indexfont );
|
indexView->SetFont( &indexfont );
|
||||||
AddChild( indexView );
|
AddChild( indexView );
|
||||||
|
|
||||||
frame = Bounds();
|
frame = Bounds();
|
||||||
frame.top = frame.bottom - INFOVIEW_HEIGHT + 1;
|
frame.top = frame.bottom - INFOVIEW_HEIGHT + 1;
|
||||||
infoView = new KouhoInfoView( frame );
|
infoView = new KouhoInfoView( frame );
|
||||||
@@ -78,7 +78,7 @@ void KouhoWindow::MessageReceived( BMessage* msg )
|
|||||||
float height, width, x, y, w;
|
float height, width, x, y, w;
|
||||||
BPoint point;
|
BPoint point;
|
||||||
BRect screenrect, frame;
|
BRect screenrect, frame;
|
||||||
|
|
||||||
switch( msg->what )
|
switch( msg->what )
|
||||||
{
|
{
|
||||||
case KOUHO_WINDOW_HIDE:
|
case KOUHO_WINDOW_HIDE:
|
||||||
@@ -91,36 +91,36 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_HIDE recieved.\n" ));
|
|||||||
standalone_mode = false;
|
standalone_mode = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KOUHO_WINDOW_SHOW:
|
case KOUHO_WINDOW_SHOW:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOW recieved.\n" ));
|
SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOW recieved.\n" ));
|
||||||
#endif
|
#endif
|
||||||
ShowWindow();
|
ShowWindow();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KOUHO_WINDOW_SHOW_ALONE:
|
case KOUHO_WINDOW_SHOW_ALONE:
|
||||||
standalone_mode = true;
|
standalone_mode = true;
|
||||||
frame = Frame();
|
frame = Frame();
|
||||||
screenrect = BScreen().Frame();
|
screenrect = BScreen().Frame();
|
||||||
frame.OffsetTo( gSettings.standalone_loc.x, gSettings.standalone_loc.y );
|
frame.OffsetTo( gSettings.standalone_loc.x, gSettings.standalone_loc.y );
|
||||||
|
|
||||||
x = screenrect.right - frame.right;
|
x = screenrect.right - frame.right;
|
||||||
y = screenrect.bottom - frame.bottom;
|
y = screenrect.bottom - frame.bottom;
|
||||||
|
|
||||||
if ( x < 0 )
|
if ( x < 0 )
|
||||||
frame.OffsetBy( x, 0 );
|
frame.OffsetBy( x, 0 );
|
||||||
|
|
||||||
if ( y < 0 )
|
if ( y < 0 )
|
||||||
frame.OffsetBy( 0, y );
|
frame.OffsetBy( 0, y );
|
||||||
|
|
||||||
gSettings.standalone_loc.x = frame.left;
|
gSettings.standalone_loc.x = frame.left;
|
||||||
gSettings.standalone_loc.y = frame.top;
|
gSettings.standalone_loc.y = frame.top;
|
||||||
point = frame.LeftTop();
|
point = frame.LeftTop();
|
||||||
MoveTo( point );
|
MoveTo( point );
|
||||||
ShowWindow();
|
ShowWindow();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KOUHO_WINDOW_SHOWAT:
|
case KOUHO_WINDOW_SHOWAT:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
|
SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
|
||||||
@@ -129,24 +129,24 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
|
|||||||
msg->FindFloat( "height", &height );
|
msg->FindFloat( "height", &height );
|
||||||
ShowAt( point, height );
|
ShowAt( point, height );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KOUHO_WINDOW_SETTEXT:
|
case KOUHO_WINDOW_SETTEXT:
|
||||||
const char* newtext;
|
const char* newtext;
|
||||||
bool hideindex, limitsize;
|
bool hideindex, limitsize;
|
||||||
msg->FindString( "text", &newtext );
|
msg->FindString( "text", &newtext );
|
||||||
kouhoView->SetText( newtext );
|
kouhoView->SetText( newtext );
|
||||||
|
|
||||||
msg->FindBool( "index", &hideindex );
|
msg->FindBool( "index", &hideindex );
|
||||||
indexView->HideNumberDisplay( hideindex );
|
indexView->HideNumberDisplay( hideindex );
|
||||||
|
|
||||||
msg->FindBool( "limit", &limitsize );
|
msg->FindBool( "limit", &limitsize );
|
||||||
height = kouhoView->TextHeight( 0, kouhoView->TextLength() );
|
height = kouhoView->TextHeight( 0, kouhoView->TextLength() );
|
||||||
height += INFOVIEW_HEIGHT;
|
height += INFOVIEW_HEIGHT;
|
||||||
|
|
||||||
msg->FindString( "info", &newtext );
|
msg->FindString( "info", &newtext );
|
||||||
infoView->SetText( newtext );
|
infoView->SetText( newtext );
|
||||||
// calculate widest line width
|
// calculate widest line width
|
||||||
width = 0;
|
width = 0;
|
||||||
for ( int32 line = 0, numlines = kouhoView->CountLines() ;
|
for ( int32 line = 0, numlines = kouhoView->CountLines() ;
|
||||||
line < numlines ; line++ )
|
line < numlines ; line++ )
|
||||||
{
|
{
|
||||||
@@ -174,13 +174,13 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to
|
|||||||
msg->FindInt32( "kouhorev", &kouhorevline );
|
msg->FindInt32( "kouhorev", &kouhorevline );
|
||||||
kouhoView->HighlightLine( kouhorevline );
|
kouhoView->HighlightLine( kouhorevline );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NUM_SELECTED_FROM_KOUHO_WIN:
|
case NUM_SELECTED_FROM_KOUHO_WIN:
|
||||||
cannaLooper->PostMessage( msg );
|
cannaLooper->PostMessage( msg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived( msg );
|
BWindow::MessageReceived( msg );
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ void KouhoWindow::ShowAt( BPoint revpoint, float height )
|
|||||||
|
|
||||||
kouhowidth = Frame().IntegerWidth();
|
kouhowidth = Frame().IntegerWidth();
|
||||||
kouhoheight = Frame().IntegerHeight();
|
kouhoheight = Frame().IntegerHeight();
|
||||||
|
|
||||||
screenrect = BScreen( this ).Frame();
|
screenrect = BScreen( this ).Frame();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f", revpoint.x, revpoint.y, height ));
|
SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f", revpoint.x, revpoint.y, height ));
|
||||||
@@ -209,16 +209,16 @@ SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f",
|
|||||||
point.y = revpoint.y - kouhoheight - WINDOW_BORDER_WIDTH_V;
|
point.y = revpoint.y - kouhoheight - WINDOW_BORDER_WIDTH_V;
|
||||||
// else
|
// else
|
||||||
// point.y = revpoint.y + height;
|
// point.y = revpoint.y + height;
|
||||||
|
|
||||||
if ( point.x + kouhowidth > screenrect.right )
|
if ( point.x + kouhowidth > screenrect.right )
|
||||||
point.x = point.x - (screenrect.right - (point.x + kouhowidth ));
|
point.x = point.x - (screenrect.right - (point.x + kouhowidth ));
|
||||||
// point.x = revpoint.x
|
// point.x = revpoint.x
|
||||||
// - ( revpoint.x + kouhowidth + WINDOW_BORDER_WIDTH - screenrect.right );
|
// - ( revpoint.x + kouhowidth + WINDOW_BORDER_WIDTH - screenrect.right );
|
||||||
// else
|
// else
|
||||||
// point.x = revpoint.x;
|
// point.x = revpoint.x;
|
||||||
|
|
||||||
MoveTo( point );
|
MoveTo( point );
|
||||||
ShowWindow();
|
ShowWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -260,7 +260,7 @@ void KouhoView::HighlightLine( int32 line )
|
|||||||
BRegion region;
|
BRegion region;
|
||||||
|
|
||||||
if ( line != -1 )
|
if ( line != -1 )
|
||||||
{
|
{
|
||||||
begin = OffsetAt( line );
|
begin = OffsetAt( line );
|
||||||
if ( line == CountLines() - 1 )
|
if ( line == CountLines() - 1 )
|
||||||
end = TextLength() + 1;
|
end = TextLength() + 1;
|
||||||
@@ -273,9 +273,9 @@ void KouhoView::HighlightLine( int32 line )
|
|||||||
//extend highlihght region to right end
|
//extend highlihght region to right end
|
||||||
highlightRect.right = Bounds().right;
|
highlightRect.right = Bounds().right;
|
||||||
Invalidate( highlightRect );
|
Invalidate( highlightRect );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -286,7 +286,7 @@ KouhoView::HighlightPartial( int32 begin, int32 end )
|
|||||||
highlightRect = region.RectAt( 0 );
|
highlightRect = region.RectAt( 0 );
|
||||||
Invalidate( highlightRect );
|
Invalidate( highlightRect );
|
||||||
}
|
}
|
||||||
|
|
||||||
void KouhoView::Draw( BRect rect )
|
void KouhoView::Draw( BRect rect )
|
||||||
{
|
{
|
||||||
BTextView::Draw( rect );
|
BTextView::Draw( rect );
|
||||||
@@ -303,7 +303,7 @@ void KouhoView::MouseDown( BPoint point )
|
|||||||
iview = (KouhoIndexView *)(Window()->FindView( "index" ));
|
iview = (KouhoIndexView *)(Window()->FindView( "index" ));
|
||||||
if ( iview->IsNumberDisplayHidden() )
|
if ( iview->IsNumberDisplayHidden() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int32 number;
|
int32 number;
|
||||||
number = LineAt( point );
|
number = LineAt( point );
|
||||||
BMessage msg( NUM_SELECTED_FROM_KOUHO_WIN );
|
BMessage msg( NUM_SELECTED_FROM_KOUHO_WIN );
|
||||||
@@ -325,7 +325,7 @@ KouhoIndexView::KouhoIndexView( BRect frame, float fontheight )
|
|||||||
indexfontheight = ht.ascent + ht.descent + ht.leading;
|
indexfontheight = ht.ascent + ht.descent + ht.leading;
|
||||||
if ( indexfontheight < lineHeight )
|
if ( indexfontheight < lineHeight )
|
||||||
fontOffset = (int32)((lineHeight - indexfontheight) / 2 + 1.5);
|
fontOffset = (int32)((lineHeight - indexfontheight) / 2 + 1.5);
|
||||||
//printf("line height=%f, index font height=%f, offset=%d\n", lineHeight, indexfontheight, fontOffset );
|
//printf("line height=%f, index font height=%f, offset=%d\n", lineHeight, indexfontheight, fontOffset );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class KouhoIndexView : public BBox
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
float lineHeight;
|
float lineHeight;
|
||||||
int32 fontOffset; //for vertical centering
|
int32 fontOffset; //for vertical centering
|
||||||
bool hideNumber;
|
bool hideNumber;
|
||||||
public:
|
public:
|
||||||
KouhoIndexView( BRect rect, float height );
|
KouhoIndexView( BRect rect, float height );
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
||||||
:BWindow( rect, B_EMPTY_STRING, kLeftTitledWindowLook,
|
:BWindow( rect, B_EMPTY_STRING, kLeftTitledWindowLook,
|
||||||
B_FLOATING_ALL_WINDOW_FEEL,
|
B_FLOATING_ALL_WINDOW_FEEL,
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE |
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE |
|
||||||
B_AVOID_FOCUS | B_WILL_ACCEPT_FIRST_CLICK )
|
B_AVOID_FOCUS | B_WILL_ACCEPT_FIRST_CLICK )
|
||||||
{
|
{
|
||||||
cannaLooper = looper;
|
cannaLooper = looper;
|
||||||
@@ -31,7 +31,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
frame.right += 3;
|
frame.right += 3;
|
||||||
back = new BBox( frame );
|
back = new BBox( frame );
|
||||||
AddChild( back );
|
AddChild( back );
|
||||||
|
|
||||||
BRect largerect( 0, 0, HexOnwidth - 1, HexOnheight - 1 );
|
BRect largerect( 0, 0, HexOnwidth - 1, HexOnheight - 1 );
|
||||||
BRect smallrect( 0, 0, HiraOnwidth - 1, HiraOnheight - 1);
|
BRect smallrect( 0, 0, HiraOnwidth - 1, HiraOnheight - 1);
|
||||||
int32 largebytes = HexOnbytesperpixel * HexOnwidth * HexOnheight;
|
int32 largebytes = HexOnbytesperpixel * HexOnwidth * HexOnheight;
|
||||||
@@ -43,9 +43,9 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
//printf( "smallbytes = %d\n", smallbytes );
|
//printf( "smallbytes = %d\n", smallbytes );
|
||||||
smallimage = new BBitmap( smallrect, cspace );
|
smallimage = new BBitmap( smallrect, cspace );
|
||||||
largeimage = new BBitmap( largerect, cspace );
|
largeimage = new BBitmap( largerect, cspace );
|
||||||
|
|
||||||
back->MovePenTo( 0, 0 );
|
back->MovePenTo( 0, 0 );
|
||||||
|
|
||||||
smallimage->SetBits( HiraOnbits, smallbytes, 0, cspace );
|
smallimage->SetBits( HiraOnbits, smallbytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( smallimage );
|
back->DrawBitmap( smallimage );
|
||||||
@@ -59,7 +59,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
HiraButton = new BPictureButton( BRect( 4, 4, 4 + HiraOnwidth - 1, 4 + HiraOnheight - 1), "hira",
|
HiraButton = new BPictureButton( BRect( 4, 4, 4 + HiraOnwidth - 1, 4 + HiraOnheight - 1), "hira",
|
||||||
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
||||||
back->AddChild( HiraButton );
|
back->AddChild( HiraButton );
|
||||||
|
|
||||||
smallimage->SetBits( KataOnbits, smallbytes, 0, cspace );
|
smallimage->SetBits( KataOnbits, smallbytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( smallimage );
|
back->DrawBitmap( smallimage );
|
||||||
@@ -73,7 +73,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
KataButton = new BPictureButton( BRect( 26, 4, 26 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "kata",
|
KataButton = new BPictureButton( BRect( 26, 4, 26 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "kata",
|
||||||
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
||||||
back->AddChild( KataButton );
|
back->AddChild( KataButton );
|
||||||
|
|
||||||
smallimage->SetBits( ZenAlphaOnbits, smallbytes, 0, cspace );
|
smallimage->SetBits( ZenAlphaOnbits, smallbytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( smallimage );
|
back->DrawBitmap( smallimage );
|
||||||
@@ -87,7 +87,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
ZenAlphaButton = new BPictureButton( BRect( 48, 4, 48 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "zenalpha",
|
ZenAlphaButton = new BPictureButton( BRect( 48, 4, 48 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "zenalpha",
|
||||||
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
||||||
back->AddChild( ZenAlphaButton );
|
back->AddChild( ZenAlphaButton );
|
||||||
|
|
||||||
smallimage->SetBits( HanAlphaOnbits, smallbytes, 0, cspace );
|
smallimage->SetBits( HanAlphaOnbits, smallbytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( smallimage );
|
back->DrawBitmap( smallimage );
|
||||||
@@ -101,7 +101,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
HanAlphaButton = new BPictureButton( BRect( 70, 4, 70 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "hanalpha",
|
HanAlphaButton = new BPictureButton( BRect( 70, 4, 70 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "hanalpha",
|
||||||
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
||||||
back->AddChild( HanAlphaButton );
|
back->AddChild( HanAlphaButton );
|
||||||
|
|
||||||
largeimage->SetBits( ExtendOnbits, largebytes, 0, cspace );
|
largeimage->SetBits( ExtendOnbits, largebytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( largeimage );
|
back->DrawBitmap( largeimage );
|
||||||
@@ -115,7 +115,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
ExtendButton = new BPictureButton( BRect( 94, 4, 94 + HexOnwidth -1 , 4 + HexOnheight - 1 ), "extend",
|
ExtendButton = new BPictureButton( BRect( 94, 4, 94 + HexOnwidth -1 , 4 + HexOnheight - 1 ), "extend",
|
||||||
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
||||||
back->AddChild( ExtendButton );
|
back->AddChild( ExtendButton );
|
||||||
|
|
||||||
largeimage->SetBits( KigoOnbits, largebytes, 0, cspace );
|
largeimage->SetBits( KigoOnbits, largebytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( largeimage );
|
back->DrawBitmap( largeimage );
|
||||||
@@ -129,7 +129,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
KigoButton = new BPictureButton( BRect( 4, 26, 4 + HexOnwidth -1, 26 + HexOnheight - 1 ), "kigo",
|
KigoButton = new BPictureButton( BRect( 4, 26, 4 + HexOnwidth -1, 26 + HexOnheight - 1 ), "kigo",
|
||||||
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
||||||
back->AddChild( KigoButton );
|
back->AddChild( KigoButton );
|
||||||
|
|
||||||
largeimage->SetBits( HexOnbits, largebytes, 0, cspace );
|
largeimage->SetBits( HexOnbits, largebytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( largeimage );
|
back->DrawBitmap( largeimage );
|
||||||
@@ -143,7 +143,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
HexButton = new BPictureButton( BRect( 34, 26, 34 + HexOnwidth -1, 26 + HexOnheight - 1 ), "hex",
|
HexButton = new BPictureButton( BRect( 34, 26, 34 + HexOnwidth -1, 26 + HexOnheight - 1 ), "hex",
|
||||||
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
||||||
back->AddChild( HexButton );
|
back->AddChild( HexButton );
|
||||||
|
|
||||||
largeimage->SetBits( BushuOnbits, largebytes, 0, cspace );
|
largeimage->SetBits( BushuOnbits, largebytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( largeimage );
|
back->DrawBitmap( largeimage );
|
||||||
@@ -158,7 +158,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
offpict, onpict, msg, B_TWO_STATE_BUTTON );
|
||||||
back->AddChild( BushuButton );
|
back->AddChild( BushuButton );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
largeimage->SetBits( TorokuOnbits, largebytes, 0, cspace );
|
largeimage->SetBits( TorokuOnbits, largebytes, 0, cspace );
|
||||||
back->BeginPicture( new BPicture );
|
back->BeginPicture( new BPicture );
|
||||||
back->DrawBitmap( largeimage );
|
back->DrawBitmap( largeimage );
|
||||||
@@ -178,10 +178,10 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper )
|
|||||||
delete largeimage;
|
delete largeimage;
|
||||||
delete offpict;
|
delete offpict;
|
||||||
delete onpict;
|
delete onpict;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PaletteWindow::MessageReceived( BMessage *msg )
|
void PaletteWindow::MessageReceived( BMessage *msg )
|
||||||
{
|
{
|
||||||
int32 mode;
|
int32 mode;
|
||||||
@@ -191,23 +191,23 @@ void PaletteWindow::MessageReceived( BMessage *msg )
|
|||||||
if ( !IsHidden() )
|
if ( !IsHidden() )
|
||||||
Hide();
|
Hide();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PALETTE_WINDOW_SHOW:
|
case PALETTE_WINDOW_SHOW:
|
||||||
if ( IsHidden() )
|
if ( IsHidden() )
|
||||||
{
|
{
|
||||||
BRect frame = Frame();
|
BRect frame = Frame();
|
||||||
BRect screenrect = BScreen().Frame();
|
BRect screenrect = BScreen().Frame();
|
||||||
float x, y;
|
float x, y;
|
||||||
|
|
||||||
x = screenrect.right - frame.right;
|
x = screenrect.right - frame.right;
|
||||||
y = screenrect.bottom - frame.bottom;
|
y = screenrect.bottom - frame.bottom;
|
||||||
|
|
||||||
if ( x < 0 )
|
if ( x < 0 )
|
||||||
frame.OffsetBy( x, 0 );
|
frame.OffsetBy( x, 0 );
|
||||||
|
|
||||||
if ( y < 0 )
|
if ( y < 0 )
|
||||||
frame.OffsetBy( 0, y );
|
frame.OffsetBy( 0, y );
|
||||||
|
|
||||||
MoveTo( frame.left, frame.top );
|
MoveTo( frame.left, frame.top );
|
||||||
SetWorkspaces( B_CURRENT_WORKSPACE );
|
SetWorkspaces( B_CURRENT_WORKSPACE );
|
||||||
Show();
|
Show();
|
||||||
@@ -270,13 +270,13 @@ void PaletteWindow::MessageReceived( BMessage *msg )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived( msg );
|
BWindow::MessageReceived( msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaletteWindow::AllButtonOff()
|
void PaletteWindow::AllButtonOff()
|
||||||
{
|
{
|
||||||
HiraButton->SetValue( B_CONTROL_OFF );
|
HiraButton->SetValue( B_CONTROL_OFF );
|
||||||
|
|||||||
Reference in New Issue
Block a user