CannaIM: style cleanup
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "KouhoWindow.h"
|
#include "KouhoWindow.h"
|
||||||
|
|
||||||
|
|
||||||
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,
|
||||||
@@ -72,20 +73,20 @@ SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" ));
|
|||||||
AddChild(infoView);
|
AddChild(infoView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KouhoWindow::MessageReceived( BMessage* msg )
|
|
||||||
|
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:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(("kouhoWindow: KOUHO_WINDOW_HIDE recieved.\n"));
|
SERIAL_PRINT(("kouhoWindow: KOUHO_WINDOW_HIDE recieved.\n"));
|
||||||
#endif
|
#endif
|
||||||
if ( !IsHidden() )
|
if (!IsHidden()) {
|
||||||
{
|
|
||||||
Hide();
|
Hide();
|
||||||
standalone_mode = false;
|
standalone_mode = false;
|
||||||
}
|
}
|
||||||
@@ -147,8 +148,7 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
|
|||||||
// 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++) {
|
||||||
{
|
|
||||||
w = kouhoView->LineWidth(line);
|
w = kouhoView->LineWidth(line);
|
||||||
if (w > width)
|
if (w > width)
|
||||||
width = w;
|
width = w;
|
||||||
@@ -157,8 +157,7 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
|
|||||||
width = minimumWidth;
|
width = minimumWidth;
|
||||||
ResizeTo(width + indexWidth + KOUHOVIEW_SIDE_MARGIN, height);
|
ResizeTo(width + indexWidth + KOUHOVIEW_SIDE_MARGIN, height);
|
||||||
|
|
||||||
if ( msg->HasBool( "partial" ) )
|
if (msg->HasBool("partial")) {
|
||||||
{
|
|
||||||
int32 begin, end;
|
int32 begin, end;
|
||||||
msg->FindInt32("revbegin", &begin);
|
msg->FindInt32("revbegin", &begin);
|
||||||
msg->FindInt32("revend", &end);
|
msg->FindInt32("revend", &end);
|
||||||
@@ -166,9 +165,7 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SERIAL_PRINT(("kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to %d\n", begin, end));
|
SERIAL_PRINT(("kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to %d\n", begin, end));
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
int32 kouhorevline;
|
int32 kouhorevline;
|
||||||
msg->FindInt32("kouhorev", &kouhorevline);
|
msg->FindInt32("kouhorev", &kouhorevline);
|
||||||
kouhoView->HighlightLine(kouhorevline);
|
kouhoView->HighlightLine(kouhorevline);
|
||||||
@@ -185,7 +182,9 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KouhoWindow::ShowAt( BPoint revpoint, float height )
|
|
||||||
|
void
|
||||||
|
KouhoWindow::ShowAt(BPoint revpoint, float height)
|
||||||
{
|
{
|
||||||
BRect screenrect;
|
BRect screenrect;
|
||||||
BPoint point;
|
BPoint point;
|
||||||
@@ -220,26 +219,27 @@ SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f",
|
|||||||
ShowWindow();
|
ShowWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KouhoWindow::FrameMoved(BPoint screenPoint)
|
KouhoWindow::FrameMoved(BPoint screenPoint)
|
||||||
{
|
{
|
||||||
if (standalone_mode)
|
if (standalone_mode)
|
||||||
gSettings.standalone_loc = screenPoint;
|
gSettings.standalone_loc = screenPoint;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ShowWindow() shows kouho window on current workspace
|
// ShowWindow() shows kouho window on current workspace
|
||||||
// This is a bug fix for version 1.0 beta 2
|
// This is a bug fix for version 1.0 beta 2
|
||||||
void
|
void
|
||||||
KouhoWindow::ShowWindow()
|
KouhoWindow::ShowWindow()
|
||||||
{
|
{
|
||||||
if ( IsHidden() )
|
if (IsHidden()) {
|
||||||
{
|
|
||||||
SetWorkspaces(B_CURRENT_WORKSPACE);
|
SetWorkspaces(B_CURRENT_WORKSPACE);
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
KouhoView section
|
KouhoView section
|
||||||
*/
|
*/
|
||||||
@@ -252,14 +252,15 @@ KouhoView::KouhoView( BRect rect )
|
|||||||
selection_color.blue = 255;
|
selection_color.blue = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KouhoView::HighlightLine( int32 line )
|
|
||||||
|
void
|
||||||
|
KouhoView::HighlightLine(int32 line)
|
||||||
{
|
{
|
||||||
//printf("highlightLine set to :%d\n", line);
|
//printf("highlightLine set to :%d\n", line);
|
||||||
int32 begin, end;
|
int32 begin, end;
|
||||||
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;
|
||||||
@@ -276,6 +277,7 @@ void KouhoView::HighlightLine( int32 line )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KouhoView::HighlightPartial(int32 begin, int32 end)
|
KouhoView::HighlightPartial(int32 begin, int32 end)
|
||||||
{
|
{
|
||||||
@@ -285,17 +287,21 @@ KouhoView::HighlightPartial( int32 begin, int32 end )
|
|||||||
Invalidate(highlightRect);
|
Invalidate(highlightRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KouhoView::Draw( BRect rect )
|
|
||||||
|
void
|
||||||
|
KouhoView::Draw(BRect rect)
|
||||||
{
|
{
|
||||||
BTextView::Draw(rect);
|
BTextView::Draw(rect);
|
||||||
rgb_color viewcolor = ViewColor();
|
// rgb_color viewcolor = ViewColor();
|
||||||
SetHighColor(selection_color);
|
SetHighColor(selection_color);
|
||||||
SetDrawingMode(B_OP_MIN);
|
SetDrawingMode(B_OP_MIN);
|
||||||
FillRect(highlightRect);
|
FillRect(highlightRect);
|
||||||
// SetViewColor(viewcolor);
|
// SetViewColor(viewcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KouhoView::MouseDown( BPoint point )
|
|
||||||
|
void
|
||||||
|
KouhoView::MouseDown(BPoint point)
|
||||||
{
|
{
|
||||||
KouhoIndexView *iview;
|
KouhoIndexView *iview;
|
||||||
iview = (KouhoIndexView *)(Window()->FindView("index"));
|
iview = (KouhoIndexView *)(Window()->FindView("index"));
|
||||||
@@ -309,6 +315,8 @@ void KouhoView::MouseDown( BPoint point )
|
|||||||
msg.AddInt8("byte", (int8)number + '1');
|
msg.AddInt8("byte", (int8)number + '1');
|
||||||
Window()->PostMessage(&msg);
|
Window()->PostMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
KouhoIndexView section
|
KouhoIndexView section
|
||||||
*/
|
*/
|
||||||
@@ -327,11 +335,12 @@ KouhoIndexView::KouhoIndexView( BRect frame, float fontheight )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KouhoIndexView::Draw( BRect rect )
|
|
||||||
|
void
|
||||||
|
KouhoIndexView::Draw(BRect rect)
|
||||||
{
|
{
|
||||||
BBox::Draw(rect);
|
BBox::Draw(rect);
|
||||||
for ( long i = 1; i < 17 ; i++ )
|
for (long i = 1; i < 17; i++) {
|
||||||
{
|
|
||||||
MovePenTo(INDEXVIEW_SIDE_MARGIN + 2, lineHeight * i - fontOffset);
|
MovePenTo(INDEXVIEW_SIDE_MARGIN + 2, lineHeight * i - fontOffset);
|
||||||
if (hideNumber)
|
if (hideNumber)
|
||||||
DrawString("•");
|
DrawString("•");
|
||||||
@@ -350,6 +359,7 @@ KouhoInfoView::KouhoInfoView( BRect frame )
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KouhoInfoView::Draw(BRect rect)
|
KouhoInfoView::Draw(BRect rect)
|
||||||
{
|
{
|
||||||
@@ -360,3 +370,4 @@ KouhoInfoView::Draw( BRect rect )
|
|||||||
StrokeLine(start, end);
|
StrokeLine(start, end);
|
||||||
BStringView::Draw(rect);
|
BStringView::Draw(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user