2013-11-28 03:47:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ManiaControl\Manialinks;
|
|
|
|
|
2014-01-28 16:54:23 +01:00
|
|
|
use FML\Controls\Frame;
|
|
|
|
use FML\Controls\Quad;
|
2013-12-29 10:03:58 +01:00
|
|
|
use FML\Controls\Quads\Quad_BgRaceScore2;
|
2014-01-28 16:54:23 +01:00
|
|
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
2013-11-28 03:47:08 +01:00
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class managing default control styles
|
|
|
|
*
|
|
|
|
* @author steeffeen & kremsy
|
|
|
|
*/
|
|
|
|
class StyleManager {
|
|
|
|
/**
|
|
|
|
* Constants
|
|
|
|
*/
|
2014-01-15 22:07:09 +01:00
|
|
|
const SETTING_LABEL_DEFAULT_STYLE = 'Default Label Style';
|
|
|
|
const SETTING_QUAD_DEFAULT_STYLE = 'Default Quad Style';
|
2013-11-28 03:47:08 +01:00
|
|
|
const SETTING_QUAD_DEFAULT_SUBSTYLE = 'Default Quad SubStyle';
|
2013-12-29 10:03:58 +01:00
|
|
|
|
2014-01-15 22:07:09 +01:00
|
|
|
const SETTING_MAIN_WIDGET_DEFAULT_STYLE = 'Main Widget Default Quad Style';
|
2013-12-29 10:03:58 +01:00
|
|
|
const SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE = 'Main Widget Default Quad SubStyle';
|
2014-01-15 22:07:09 +01:00
|
|
|
const SETTING_LIST_WIDGETS_WIDTH = 'List Widgets Width';
|
|
|
|
const SETTING_LIST_WIDGETS_HEIGHT = 'List Widgets Height';
|
|
|
|
|
|
|
|
const SETTING_ICON_DEFAULT_OFFSET_SM = 'Default Icon Offset in Shootmania';
|
|
|
|
|
2013-11-28 03:47:08 +01:00
|
|
|
/**
|
|
|
|
* Private properties
|
|
|
|
*/
|
|
|
|
private $maniaControl = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new style manager instance
|
|
|
|
*
|
2014-01-15 22:07:09 +01:00
|
|
|
* @param ManiaControl $maniaControl
|
2013-11-28 03:47:08 +01:00
|
|
|
*/
|
|
|
|
public function __construct(ManiaControl $maniaControl) {
|
|
|
|
$this->maniaControl = $maniaControl;
|
2014-01-15 22:07:09 +01:00
|
|
|
|
2013-11-28 03:47:08 +01:00
|
|
|
// Init settings
|
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LABEL_DEFAULT_STYLE, 'TextTitle1');
|
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_QUAD_DEFAULT_STYLE, 'Bgs1InRace');
|
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE, 'BgTitleShadow');
|
2013-12-29 10:03:58 +01:00
|
|
|
|
|
|
|
//Main Widget
|
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_STYLE, Quad_BgRaceScore2::STYLE);
|
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE, Quad_BgRaceScore2::SUBSTYLE_HandleSelectable);
|
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LIST_WIDGETS_WIDTH, '150');
|
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LIST_WIDGETS_HEIGHT, '80');
|
2014-01-15 22:07:09 +01:00
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_ICON_DEFAULT_OFFSET_SM, '20');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default Icon Offset for shootmania
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getDefaultIconOffsetSM() {
|
|
|
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_ICON_DEFAULT_OFFSET_SM);
|
2013-11-28 03:47:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default label style
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getDefaultLabelStyle() {
|
|
|
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_LABEL_DEFAULT_STYLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default quad style
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getDefaultQuadStyle() {
|
|
|
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_QUAD_DEFAULT_STYLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default quad substyle
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getDefaultQuadSubstyle() {
|
|
|
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE);
|
|
|
|
}
|
2013-12-29 10:03:58 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default main window style
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2014-01-15 22:07:09 +01:00
|
|
|
public function getDefaultMainWindowStyle() {
|
2013-12-29 10:03:58 +01:00
|
|
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_STYLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default main window substyle
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2014-01-15 22:07:09 +01:00
|
|
|
public function getDefaultMainWindowSubStyle() {
|
2013-12-29 10:03:58 +01:00
|
|
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default list widget width
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2014-01-15 22:07:09 +01:00
|
|
|
public function getListWidgetsWidth() {
|
2013-12-29 10:03:58 +01:00
|
|
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_LIST_WIDGETS_WIDTH);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default list widget height
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2014-01-15 22:07:09 +01:00
|
|
|
public function getListWidgetsHeight() {
|
2013-12-29 10:03:58 +01:00
|
|
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_LIST_WIDGETS_HEIGHT);
|
|
|
|
}
|
|
|
|
|
2014-01-28 16:54:23 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds the Default List Frame
|
|
|
|
*
|
|
|
|
* @return Frame $frame
|
|
|
|
*/
|
|
|
|
public function defaultListFrame() {
|
|
|
|
$width = $this->getListWidgetsWidth();
|
|
|
|
$height = $this->getListWidgetsHeight();
|
|
|
|
$quadStyle = $this->getDefaultMainWindowStyle();
|
|
|
|
$quadSubstyle = $this->getDefaultMainWindowSubStyle();
|
|
|
|
|
|
|
|
// mainframe
|
|
|
|
$frame = new Frame();
|
|
|
|
$frame->setSize($width, $height);
|
|
|
|
$frame->setPosition(0, 0);
|
|
|
|
|
|
|
|
// Background Quad
|
|
|
|
$backgroundQuad = new Quad();
|
|
|
|
$frame->add($backgroundQuad);
|
|
|
|
$backgroundQuad->setSize($width, $height);
|
|
|
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
|
|
|
|
|
|
|
// Add Close Quad (X)
|
|
|
|
$closeQuad = new Quad_Icons64x64_1();
|
|
|
|
$frame->add($closeQuad);
|
|
|
|
$closeQuad->setPosition($width * 0.483, $height * 0.467, 3);
|
|
|
|
$closeQuad->setSize(6, 6);
|
|
|
|
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
|
|
|
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
|
|
|
|
|
|
|
return $frame;
|
|
|
|
}
|
2013-11-28 03:47:08 +01:00
|
|
|
}
|