Colour Manager: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 12: Line 12:
** <tt>QString* docColSet = prefsManager->colorSetName()</tt> (cannot be used outside of the constructor)
** <tt>QString* docColSet = prefsManager->colorSetName()</tt> (cannot be used outside of the constructor)
** <tt>QStringList customColSet = custColSet = prefsManager->appPrefs.CustomColorSets</tt>
** <tt>QStringList customColSet = custColSet = prefsManager->appPrefs.CustomColorSets</tt>
* The list of colours are read by the colour manager from the palettes and written to a <tt>m_Doc</tt> property.
* The list of used colors can be read throug <tt>void m_Doc->getUsedColor(& ColorList &colorsToUse, bool spot)</tt>
=== Implementing the possibility to hide unused colours ===
==== Adding a preference field ====
* Add a property in <tt>prefsmanager.h</tt>
* Add a method for reading and one for writing it in <tt>prefsmanager.cpp</tt>
==== Setting the preference from the Colour Management Dialog ====
* Set the prefsManager as a local variable
* Add a checkbox to the dialog
* Read and set the preference
* "Notify" the strings that are to be translated
* Correctly filter the list according to the preference
==== Filter out the hidden colours in every colour list ====
* Find all the colour lists
* Check if the unused are to be shown, and if not, don't show them (probably, through asking <tt>m_Doc->getUsedColor()</tt>

Revision as of 17:33, 25 August 2007


The Colour Manager

  • The colour manager is defined by colorm.cpp
  • It's called by scribus.cpp as follows:
ColorManager* dia = new ColorManager(this, edc, doc, prefsManager->colorSetName(), prefsManager->appPrefs.CustomColorSets);
  • The constructors parameters are named as:
    • QWidget* parent = this (cannot be used outside of the constructor)
    • ColorList EditColors = doco = edc = (HaveDoc ? doc->PageColors : prefsManager->colorSet())
    • ScribusDoc* m_Doc = doc
    • QString* docColSet = prefsManager->colorSetName() (cannot be used outside of the constructor)
    • QStringList customColSet = custColSet = prefsManager->appPrefs.CustomColorSets
  • The list of colours are read by the colour manager from the palettes and written to a m_Doc property.
  • The list of used colors can be read throug void m_Doc->getUsedColor(& ColorList &colorsToUse, bool spot)

Implementing the possibility to hide unused colours

Adding a preference field

  • Add a property in prefsmanager.h
  • Add a method for reading and one for writing it in prefsmanager.cpp

Setting the preference from the Colour Management Dialog

  • Set the prefsManager as a local variable
  • Add a checkbox to the dialog
  • Read and set the preference
  • "Notify" the strings that are to be translated
  • Correctly filter the list according to the preference

Filter out the hidden colours in every colour list

  • Find all the colour lists
  • Check if the unused are to be shown, and if not, don't show them (probably, through asking m_Doc->getUsedColor()