2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-08-18 12:58:51 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-08-18 12:58:51 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-08-18 12:58:51 +00:00
|
|
|
*
|
2019-03-02 00:52:00 +11:00
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
2009-08-18 12:58:51 +00:00
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spuserpref
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2009-08-18 12:58:51 +00:00
|
|
|
#include <string.h>
|
2019-03-02 00:52:00 +11:00
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
2019-07-12 15:45:52 +10:00
|
|
|
#include "BKE_global.h"
|
2019-07-05 16:36:01 +10:00
|
|
|
#include "BKE_main.h"
|
2019-03-02 00:52:00 +11:00
|
|
|
#include "BKE_report.h"
|
|
|
|
|
|
|
|
|
|
#include "RNA_types.h"
|
|
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
|
|
|
|
|
|
|
|
|
#include "../interface/interface_intern.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
|
|
#include "ED_userpref.h"
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Reset Default Theme
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
|
|
|
|
|
{
|
2019-07-05 16:36:01 +10:00
|
|
|
Main *bmain = CTX_data_main(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
UI_theme_init_default();
|
|
|
|
|
UI_style_init_default();
|
2019-07-05 16:36:01 +10:00
|
|
|
WM_reinit_gizmomap_all(bmain);
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
2019-05-21 11:26:47 -03:00
|
|
|
U.runtime.is_dirty = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
return OPERATOR_FINISHED;
|
2019-03-02 00:52:00 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void PREFERENCES_OT_reset_default_theme(wmOperatorType *ot)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Reset to Default Theme";
|
|
|
|
|
ot->idname = "PREFERENCES_OT_reset_default_theme";
|
|
|
|
|
ot->description = "Reset to the default theme colors";
|
2019-03-02 00:52:00 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* callbacks */
|
|
|
|
|
ot->exec = reset_default_theme_exec;
|
2019-03-02 00:52:00 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* flags */
|
|
|
|
|
ot->flag = OPTYPE_REGISTER;
|
2019-03-02 00:52:00 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
void ED_operatortypes_userpref(void)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_operatortype_append(PREFERENCES_OT_reset_default_theme);
|
2019-03-02 00:52:00 +11:00
|
|
|
}
|