-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added possibility to switch off the delay - fixed window behaviour #39
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
#include "Shuffle.h" | ||
|
||
#include <Application.h> | ||
#include <Alert.h> | ||
#include <Bitmap.h> | ||
#include <Catalog.h> | ||
#include <ControlLook.h> | ||
|
@@ -44,7 +45,6 @@ enum | |
|
||
const float kDraggerSize = 7.0f; | ||
|
||
|
||
Tipster::Tipster() | ||
: | ||
BGroupView("Tipster") | ||
|
@@ -62,15 +62,21 @@ Tipster::Tipster() | |
|
||
fTipsterTextView = new TipsterText(); | ||
fIcon = new BButton("iconview", "", new BMessage(OPEN_URL)); | ||
fIcon -> SetToolTip( B_TRANSLATE("Open the Tipster homepage") ); | ||
thaflo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
BDragger* dragger = new BDragger(this); | ||
|
||
BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0) | ||
.SetInsets(-2, -2, 0, -2) | ||
.Add(fIcon) | ||
.SetInsets(1, 1, 1, 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those insets were on purpose to avoid the smal spacing around the icon and have it flush with the view borders. It should be kept as is, IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe that's a question to discuss about :-) For me this way looks more as a button as when it's completely attached |
||
.AddGroup(B_VERTICAL,0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does putting the icon in a Group solve? I don't see a dfference... |
||
.Add(fIcon) | ||
.AddGlue() | ||
.End() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for an empty line, I think. The indentation is obvious enough to distinguish separate elements. |
||
.AddStrut(be_control_look->DefaultItemSpacing()) | ||
.AddGroup(B_VERTICAL,0) | ||
.Add(fTipsterTextView) | ||
|
||
thaflo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.AddGroup(B_HORIZONTAL, 0) | ||
.AddGlue() | ||
.Add(dragger) | ||
|
@@ -198,7 +204,6 @@ Tipster::QuitRequested() | |
return true; | ||
} | ||
|
||
|
||
void | ||
Tipster::AttachedToWindow() | ||
{ | ||
|
@@ -280,9 +285,13 @@ Tipster::_LoadSettings() | |
void | ||
Tipster::_ResetTimer() | ||
{ | ||
BMessage message(UPDATE_TIP); | ||
delete fRunner; | ||
fRunner = new BMessageRunner(this, message, fDelay); | ||
if (fDelay > 0) { | ||
// if delay is set to Off (0), don't send a runner message | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This empty line isn't needed.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, that's a big help for me! Didn't know how to solve it ... |
||
BMessage message(UPDATE_TIP); | ||
delete fRunner; | ||
fRunner = new BMessageRunner(this, message, fDelay); | ||
} | ||
} | ||
|
||
|
||
|
@@ -372,7 +381,6 @@ Tipster::MouseDown(BPoint point) | |
} | ||
} | ||
|
||
|
||
void | ||
Tipster::UpdateIcon(BString artwork, BString url) | ||
{ | ||
|
@@ -489,9 +497,11 @@ Tipster::GetTipsFile() | |
|
||
for (int32 i = 0; (language = message.GetString("language", i, NULL)) | ||
!= NULL; i++) { | ||
if (getLocalTipsFile(ref, language)) | ||
printf("lang: %s \n", language); | ||
thaflo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (getLocalTipsFile(ref, language)) // | ||
return ref; | ||
else if (getLocalTipsFile(ref, BString(language, | ||
else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coding style says "else if" on one line. |
||
if (getLocalTipsFile(ref, BString(language, | ||
BString(language).FindFirst("_")))) | ||
return ref; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,9 @@ | |
|
||
enum | ||
{ | ||
UPDATE_TIP = 'uptp' | ||
UPDATE_TIP = 'uptp', | ||
NEXT_TIP = 'nxtp', | ||
PREVIOUS_TIP = 'pvtp' | ||
}; | ||
|
||
|
||
|
@@ -42,12 +44,12 @@ TipsterText::Instantiate(BMessage *data) | |
{ | ||
if (!validate_instantiation(data, "TipsterText")) { | ||
printf("Could not complete instantiation...\n"); | ||
|
||
return NULL; | ||
} | ||
|
||
printf("Instantiation validated...\n"); | ||
|
||
return new TipsterText(data); | ||
} | ||
|
||
|
@@ -56,7 +58,7 @@ void | |
TipsterText::AttachedToWindow() | ||
{ | ||
fMessenger = new BMessenger(this->Parent()); | ||
|
||
SetViewColor(Parent()->ViewColor()); | ||
|
||
BTextView::AttachedToWindow(); | ||
|
@@ -71,8 +73,10 @@ TipsterText::MouseDown(BPoint point) | |
GetMouse(&temp, &buttons); | ||
|
||
if (Bounds().Contains(temp)) { | ||
BMessage message(UPDATE_TIP); | ||
|
||
fMessenger->SendMessage(&message); | ||
if (buttons == 1) //left mouse button | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Insted of a comment, you can use the constants B_PRIMARY_MOUSE_BUTTON and B_SECONDARY_MOUSE_BUTTON. |
||
fMessenger->SendMessage(NEXT_TIP); | ||
if (buttons == 2) //right mouse button | ||
fMessenger->SendMessage(PREVIOUS_TIP); | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the | B_NOT_V_RESIZABLE? Now the window can be resized in a way that shows a large grey area.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way it is possible to have a smaller window but visible the whole tip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well... it's not really smaller, it's narrower but has to be taller. You can always have the whole tip visible by making the window wider. We try to keep the tips as short as possible to fit into a reasonably sized window (or replicated view). IMO keeping the window height equal to the icon button height looks much nicer.