| Summary: | labels' context menu's "size" doesn't work and isn't what it should be | ||
|---|---|---|---|
| Product: | [Applications] kig | Reporter: | Stefan Monov <logixoul> |
| Component: | general | Assignee: | Pino Toscano <pino> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Stefan Monov
2006-02-20 22:49:12 UTC
SVN commit 512879 by pino:
Do not show the Style and the Size submenus in the object popup if the selection
contains only labels.
CCBUGS: 122381, 122382
M +15 -3 popup.cc
M +5 -0 popup.h
--- branches/KDE/3.5/kdeedu/kig/modes/popup.cc #512878:512879
@@ -33,6 +33,7 @@
#include "../objects/other_type.h"
#include "../objects/object_factory.h"
#include "../objects/polygon_imp.h"
+#include "../objects/text_imp.h"
#include "../misc/lists.h"
#include "../misc/argsparser.h"
#include "../misc/kigpainter.h"
@@ -184,7 +185,7 @@
const std::vector<ObjectHolder*>& objs,
const QPoint& plc )
: KPopupMenu( &view ), mplc( plc ), mpart( part ), mview( view ), mobjs( objs ),
- mmode( mode )
+ mmode( mode ), monlylabels( false )
{
bool empty = objs.empty();
bool single = objs.size() == 1;
@@ -204,6 +205,17 @@
title = i18n( "%1 Objects" ).arg( objs.size() );
insertTitle( title, 1 );
+ if ( !empty )
+ {
+ monlylabels = true;
+ uint i = 0;
+ while ( i < objs.size() && monlylabels )
+ {
+ monlylabels &= objs[i]->imp()->inherits( TextImp::stype() );
+ ++i;
+ }
+ }
+
if ( empty )
{
// provides some diverse stuff like "unhide all", set coordinate
@@ -399,7 +411,7 @@
}
popup.addAction( menu, i18n( "&Custom Color" ), nextfree++ );
}
- else if ( menu == NormalModePopupObjects::SetSizeMenu )
+ else if ( menu == NormalModePopupObjects::SetSizeMenu && !popup.onlyLabels() )
{
bool point = true;
bool samecolor = true;
@@ -434,7 +446,7 @@
popup.addAction( menu, p, nextfree++ );
};
}
- else if ( menu == NormalModePopupObjects::SetStyleMenu )
+ else if ( menu == NormalModePopupObjects::SetStyleMenu && !popup.onlyLabels() )
{
bool samecolor = true;
int npoints = 0;
--- branches/KDE/3.5/kdeedu/kig/modes/popup.h #512878:512879
@@ -75,6 +75,8 @@
KigWidget& widget() { return mview; };
QPoint plc() { return mplc; };
+ bool onlyLabels() const { return monlylabels; };
+
protected:
void activateAction( int menu, int action );
@@ -100,6 +102,9 @@
std::vector<PopupActionProvider*> mproviders;
QPopupMenu* mmenus[NumberOfMenus];
+
+private:
+ bool monlylabels;
};
/**
SVN commit 512881 by pino:
Do not show the Style and the Size submenus in the object popup if the selection
contains only labels.
BUGS: 122381, 122382
M +15 -3 popup.cc
M +5 -0 popup.h
--- trunk/KDE/kdeedu/kig/modes/popup.cc #512880:512881
@@ -33,6 +33,7 @@
#include "../objects/other_type.h"
#include "../objects/object_factory.h"
#include "../objects/polygon_imp.h"
+#include "../objects/text_imp.h"
#include "../objects/text_type.h"
#include "../misc/lists.h"
#include "../misc/argsparser.h"
@@ -186,7 +187,7 @@
const std::vector<ObjectHolder*>& objs,
const QPoint& plc )
: KMenu( &view ), mplc( plc ), mpart( part ), mview( view ), mobjs( objs ),
- mmode( mode )
+ mmode( mode ), monlylabels( false )
{
bool empty = objs.empty();
bool single = objs.size() == 1;
@@ -205,6 +206,17 @@
title = i18n( "%1 Objects" ).arg( objs.size() );
addTitle( title );
+ if ( !empty )
+ {
+ monlylabels = true;
+ uint i = 0;
+ while ( i < objs.size() && monlylabels )
+ {
+ monlylabels &= objs[i]->imp()->inherits( TextImp::stype() );
+ ++i;
+ }
+ }
+
if ( empty )
{
// provides some diverse stuff like "unhide all", set coordinate
@@ -378,7 +390,7 @@
QPixmap icon = l->loadIcon( "colorize", KIcon::Small, 22, KIcon::DefaultState, 0L, true );
popup.addInternalAction( menu, icon, i18n( "&Custom Color" ), nextfree++ );
}
- else if ( menu == NormalModePopupObjects::SetSizeMenu )
+ else if ( menu == NormalModePopupObjects::SetSizeMenu && !popup.onlyLabels() )
{
bool point = true;
bool samecolor = true;
@@ -413,7 +425,7 @@
popup.addInternalAction( menu, p, nextfree++ );
};
}
- else if ( menu == NormalModePopupObjects::SetStyleMenu )
+ else if ( menu == NormalModePopupObjects::SetStyleMenu && !popup.onlyLabels() )
{
bool samecolor = true;
int npoints = 0;
--- trunk/KDE/kdeedu/kig/modes/popup.h #512880:512881
@@ -73,6 +73,8 @@
KigWidget& widget() { return mview; };
QPoint plc() { return mplc; };
+ bool onlyLabels() const { return monlylabels; };
+
protected:
void activateAction( int menu, int action );
@@ -89,6 +91,9 @@
std::vector<PopupActionProvider*> mproviders;
QMenu* mmenus[NumberOfMenus];
+
+private:
+ bool monlylabels;
};
/**
SVN commit 512880 by pino:
Do not show the Style and the Size submenus in the object popup if the selection
contains only labels.
CCBUGS: 122381, 122382
M +15 -3 popup.cc
M +5 -0 popup.h
--- branches/kig/post-kde-3.5/kig/modes/popup.cc #512879:512880
@@ -33,6 +33,7 @@
#include "../objects/other_type.h"
#include "../objects/object_factory.h"
#include "../objects/polygon_imp.h"
+#include "../objects/text_imp.h"
#include "../objects/text_type.h"
#include "../misc/lists.h"
#include "../misc/argsparser.h"
@@ -186,7 +187,7 @@
const std::vector<ObjectHolder*>& objs,
const QPoint& plc )
: KPopupMenu( &view ), mplc( plc ), mpart( part ), mview( view ), mobjs( objs ),
- mmode( mode )
+ mmode( mode ), monlylabels( false )
{
bool empty = objs.empty();
bool single = objs.size() == 1;
@@ -206,6 +207,17 @@
title = i18n( "%1 Objects" ).arg( objs.size() );
insertTitle( title, 1 );
+ if ( !empty )
+ {
+ monlylabels = true;
+ uint i = 0;
+ while ( i < objs.size() && monlylabels )
+ {
+ monlylabels &= objs[i]->imp()->inherits( TextImp::stype() );
+ ++i;
+ }
+ }
+
if ( empty )
{
// provides some diverse stuff like "unhide all", set coordinate
@@ -401,7 +413,7 @@
}
popup.addAction( menu, i18n( "&Custom Color" ), nextfree++ );
}
- else if ( menu == NormalModePopupObjects::SetSizeMenu )
+ else if ( menu == NormalModePopupObjects::SetSizeMenu && !popup.onlyLabels() )
{
bool point = true;
bool samecolor = true;
@@ -436,7 +448,7 @@
popup.addAction( menu, p, nextfree++ );
};
}
- else if ( menu == NormalModePopupObjects::SetStyleMenu )
+ else if ( menu == NormalModePopupObjects::SetStyleMenu && !popup.onlyLabels() )
{
bool samecolor = true;
int npoints = 0;
--- branches/kig/post-kde-3.5/kig/modes/popup.h #512879:512880
@@ -75,6 +75,8 @@
KigWidget& widget() { return mview; };
QPoint plc() { return mplc; };
+ bool onlyLabels() const { return monlylabels; };
+
protected:
void activateAction( int menu, int action );
@@ -100,6 +102,9 @@
std::vector<PopupActionProvider*> mproviders;
QPopupMenu* mmenus[NumberOfMenus];
+
+private:
+ bool monlylabels;
};
/**
|