diff options
author | Hans Lambermont <hans@lambermont.dyndns.org> | 2002-10-12 15:37:38 +0400 |
---|---|---|
committer | Hans Lambermont <hans@lambermont.dyndns.org> | 2002-10-12 15:37:38 +0400 |
commit | 12315f4d0e0ae993805f141f64cb8c73c5297311 (patch) | |
tree | 59b45827cd8293cfb727758989c7a74b40183974 /intern/action |
Initial revisionv2.25
Diffstat (limited to 'intern/action')
21 files changed, 2706 insertions, 0 deletions
diff --git a/intern/action/ACT_Action.h b/intern/action/ACT_Action.h new file mode 100644 index 00000000000..2b54d10359e --- /dev/null +++ b/intern/action/ACT_Action.h @@ -0,0 +1,140 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +#ifndef _H_ACT_ACTION_H_ +#define _H_ACT_ACTION_H_ + +#include "MEM_RefCounted.h" +#include "STR_String.h" + +/** + * An action that can be applied or undone. + * Virtual base class for actions with a name. + * An action object inherits the shared object reference count mechanism. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +class ACT_Action : public MEM_RefCounted { +public: + /** + * Constructs an action with the given name . + * @param name the name of the action. + * @param applied state of the action after creation. + */ + ACT_Action(const STR_String& name, bool applied = false); + + /** + * Returns the name of the action. + * @param name the name of the action. + */ + inline virtual void getName(STR_String& name) const; + + /** + * Returns the name of the action as a pointer to the data of the string. + * @return pointer to the name of the action. + */ + inline virtual char* getName(); + + /** + * Sets the name of the action. + * @param name the name of the action. + */ + inline virtual void setName(const STR_String& name); + + /** + * Returns whether this action is applied. + * @return whether this action is applied. + */ + inline virtual bool getIsApplied() const; + + + /** + * Call this member to apply an action. + * Child classes should override the doApply member to implement apply functionality. + * @see doApply. + */ + virtual void apply(); + + /** + * Call this member to undo an action . + * Child classes should override the doUndo member to implement undo functionality. + * @see doApply() + */ + virtual void undo(); + +protected: + /** + * Implementations should overload this method to provide the apply functionality. + */ + virtual void doApply() = 0; + + /** + * Implementations should overload this method to provide the undo functionality. + */ + virtual void doUndo() = 0; + + /** Name of this action */ + STR_String m_name; + /** Is this action already applied? */ + bool m_applied; +}; + + +void ACT_Action::getName(STR_String& name) const +{ + name = m_name; +} + +char* ACT_Action::getName() +{ + return m_name.Ptr(); +} + +void ACT_Action::setName(const STR_String& name) +{ + m_name = name; +} + +inline bool ACT_Action::getIsApplied() const +{ + return m_applied; +} + +#endif // _H_ACT_ACTION_H_
\ No newline at end of file diff --git a/intern/action/ACT_ActionC-Api.h b/intern/action/ACT_ActionC-Api.h new file mode 100644 index 00000000000..ebc1ce7d5a0 --- /dev/null +++ b/intern/action/ACT_ActionC-Api.h @@ -0,0 +1,192 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * Interface for C access to actions. + * @author Maarten Gribnau + * @date April, 25, 2001 + */ + +#ifndef _H_ACT_ACTION_C_API +#define _H_ACT_ACTION_C_API + +#include "MEM_RefCountedC-Api.h" + +/** A pointer to an action object. */ +typedef MEM_TRefCountedObjectPtr ACT_ActionPtr; +/** A pointer to an action stack object. */ +typedef MEM_TObjectPtr ACT_ActionStackPtr; + + +/** A pointer to user data passed by the callbacks. */ +typedef void* ACT_ActionUserDataPtr; + +/** + * An action apply callback routine. + * @param action The action that should be applied. + * @param userData The pointer to the user data provided when the action was created. + */ +typedef void (*ACT_ActionApplyProcPtr)(ACT_ActionPtr action, ACT_ActionUserDataPtr userData); + +/** + * An action undo callback routine. + * @param action The action that should be undone. + * @param userData The pointer to the user data provided when the action was created. + */ +typedef void (*ACT_ActionUndoProcPtr)(ACT_ActionPtr action, ACT_ActionUserDataPtr userData); + +/** + * An action dispose callback routine. + * @param action The action that is disposed. + * @param userData The pointer to the user data provided when the action was created. + */ +typedef void (*ACT_ActionDisposeProcPtr)(ACT_ActionPtr action, ACT_ActionUserDataPtr userData); + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * An action is a shared object that can be applied or undone. + */ + +/** + * Creates a new action. + * This is an action that calls the given callbacks when it needs to be applied or undone. + * @param name The name of the action. + * @param isApplied Indication as to whether the action is already applied (0 = not applied). + * @param userData Pointer passed to the apply/undo callbacks. + * @param applyProc Pointer to the callback invoked when the action needs to be applied. + * @param undoProc Pointer to the callback invoked when the action needs to be undone. + * @return The new action (null in case of error). + */ +extern ACT_ActionPtr ACT_ActionCreate( + char* name, + int isApplied, + ACT_ActionUserDataPtr userData, + ACT_ActionApplyProcPtr applyProc, + ACT_ActionUndoProcPtr undoProc, + ACT_ActionDisposeProcPtr disposeProc); + +/** + * Returns the name of an action. + * @return The name of the action (null in case of error). + */ +extern char* ACT_ActionGetName(ACT_ActionPtr action); + + + +/** + * An action stack stores actions and implements undo/redo functionality. + */ + +/** + * Creates a new action stack. + * @param stackSize The maximum number of actions on the stack. + * @return The new stack (or NULL in case of error). + */ +extern ACT_ActionStackPtr ACT_ActionStackCreate(unsigned int stackSize); + +/** + * Disposes an action stack. + * @param stack The appropriate stack. + */ +extern void ACT_ActionStackDispose(ACT_ActionStackPtr stack); + +/** + * Returns the current depth of the stack. + * @param stack The appropriate stack. + * @return the current stack depth. + */ +extern unsigned int ACT_ActionStackGetStackDepth(ACT_ActionStackPtr stack); + +/** + * Returns the current maximum depth of the stack. + * @param stack The appropriate stack. + * @return the maximum stack depth. + */ +extern unsigned int ACT_ActionStackGetMaxStackDepth(ACT_ActionStackPtr stack); + +/** + * Sets new maximum depth of the stack. + * @param stack The appropriate stack. + * @param maxStackDepth The new stack depth. + */ +extern void ACT_ActionStackSetMaxStackDepth(ACT_ActionStackPtr stack, unsigned int maxStackDepth); + +/** + * Pushes an action on the stack. + * If the action has not been applied yet, it will be applied here. + * This will increase the reference count of the action. + * If there is not enough capacity, the action at the bottom of the stack is removed (and its reference count decreased). + * @param stack The appropriate stack. + * @param action the action that is pushed onto the stack. + */ +extern void ACT_ActionStackPush(ACT_ActionStackPtr stack, ACT_ActionPtr action); + +/** + * Returns pointer to the current undo item. + * @param stack The appropriate stack. + * @return The action scheduled for undo (0 if there is none). + */ +extern ACT_ActionStackPtr ACT_ActionStackPeekUndo(ACT_ActionStackPtr stack); + +/** + * Returns pointer to the current redo item. + * @param stack The appropriate stack. + * @return The action scheduled for redo (0 if there is none). + */ +extern ACT_ActionStackPtr ACT_ActionStackPeekRedo(ACT_ActionStackPtr stack); + +/** + * Undos the current action. + * @param stack The appropriate stack. + * This will move the current undo index down (if the stack depth allows it). + */ +extern void ACT_ActionStackUndo(ACT_ActionStackPtr stack); + +/** + * Redos the current action. + * @param stack The appropriate stack. + * This will move the action index up (if the stack depth allows it). + */ +extern void ACT_ActionStackRedo(ACT_ActionStackPtr stack); + + +#ifdef __cplusplus +} +#endif + +#endif // _H_ACT_ACTION_C_API
\ No newline at end of file diff --git a/intern/action/ACT_ActionStack.h b/intern/action/ACT_ActionStack.h new file mode 100644 index 00000000000..13db963020e --- /dev/null +++ b/intern/action/ACT_ActionStack.h @@ -0,0 +1,184 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +#ifndef _H_ACT_ACTIONSTACK +#define _H_ACT_ACTIONSTACK + +#include "ACT_Action.h" +#include <deque> + + +/** + * A stack with actions that implements undo/redo capabilities. + * A stack can grow to a maximum number of actions by pushing actions on the stack. + * By calling undo and redo the apply and undo members of the actions on the stack are called. + * In addition, this will move the stackIndex up and down the stack. + * When a new action is pushed onto the stack, the actions above the current action are removed from the stack. + * Actions pushed onto the stack are applied if they are not applied already. + * @todo implement error handling (e.g. memory errors) + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +class ACT_ActionStack { +public: + /** + * Constructs an action stack. + */ + ACT_ActionStack(unsigned int maxStackDepth = 1); + + /** + * Destructs an action stack. + */ + virtual ~ACT_ActionStack(); + + /** + * Returns the current depth of the stack. + * @return the current stack depth. + */ + virtual unsigned int getStackDepth() const; + + /** + * Returns the current maximum depth of the stack. + * @return the maximum stack depth. + */ + virtual unsigned int getMaxStackDepth() const; + + /** + * Sets new maximum depth of the stack. + * @param maxStackDepth The new stack depth. + */ + virtual void setMaxStackDepth(unsigned int maxStackDepth); + + /** + * Pushes an action on the stack. + * If the action has not been applied yet, it will be applied here. + * This will increase the reference count of the action. + * If there is not enough capacity, the action at the bottom of the stack is removed (and its reference count decreased). + * @param action the action that is pushed onto the stack. + */ + virtual void push(ACT_Action& action); + + /** + * Returns pointer to the current undo item. + * @return The action scheduled for undo (0 if there is none). + */ + virtual ACT_Action* peekUndo(); + + /** + * Returns pointer to the current redo item. + * @return The action scheduled for redo (0 if there is none). + */ + virtual ACT_Action* peekRedo(); + + /** + * Flushes the action stack. + * All actions are removed from the stack and their reference counts decreased. + */ + virtual void flush(); + + /** + * Returns whether we can undo the current action. + * @return Indication of the possibility to undo. + */ + virtual bool canUndo() const; + + /** + * Undos the current action. + * This will move the current undo index down (if the stack depth allows it). + */ + virtual void undo(); + + /** + * Returns whether we can redo the current action. + * @return Indication of the possibility to redo. + */ + virtual bool canRedo() const; + + /** + * Redos the current action. + * This will move the action index up (if the stack depth allows it). + */ + virtual void redo(); + +protected: + /** + * Removes <i>numActions</i> actions from the back of the stack. + * @param numActions number of items to remove. + * @return the number of actions removed. + */ + virtual unsigned int popBack(unsigned int numActions = 1); + + /** + * Removes <i>numActions</i> actions from the front of the stack. + * @param numActions number of items to remove. + * @return the number of actions removed. + */ + virtual unsigned int popFront(unsigned int numActions = 1); + + /** + * Returns the index of the current undo action. + * @param index The index of the action. + * @return Indication as to whether the index is valid (==true). + */ + virtual bool getUndoIndex(unsigned int& index) const; + + /** + * Returns the index of the current redo action. + * @param index The index of the action. + * @return Indication as to whether the index is valid (==true). + */ + virtual bool getRedoIndex(unsigned int& index) const; + + /** The maximum depth of this stack. */ + unsigned int m_maxStackDepth; + /** The index of the current undo action in the stack. */ + unsigned int m_undoIndex; + /** Is the index of the current undo action in the stack valid? */ + bool m_undoIndexValid; + /** The index of the current redo action in the stack. */ + unsigned int m_redoIndex; + /** Is the index of the current redo action in the stack valid? */ + bool m_redoIndexValid; + /** The stack with actions. */ + deque<ACT_Action*> m_stack; +}; + + +#endif // _H_ACT_ACTIONSTACK
\ No newline at end of file diff --git a/intern/action/Makefile b/intern/action/Makefile new file mode 100644 index 00000000000..dd5301c034e --- /dev/null +++ b/intern/action/Makefile @@ -0,0 +1,52 @@ +# +# $Id$ +# +# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** +# +# 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 +# of the License, or (at your option) any later version. The Blender +# Foundation also sells licenses for use in proprietary software under +# the Blender License. See http://www.blender.org/BL/ for information +# about this. +# +# 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, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. +# All rights reserved. +# +# The Original Code is: all of this file. +# +# Contributor(s): none yet. +# +# ***** END GPL/BL DUAL LICENSE BLOCK ***** +# action main makefile. +# + +include nan_definitions.mk + +LIBNAME = action +SOURCEDIR = intern/$(LIBNAME) +DIR = $(OCGDIR)/$(SOURCEDIR) +DIRS = intern +TESTDIRS = test + +include nan_subdirs.mk + +install: all debug + @[ -d $(NAN_ACTION) ] || mkdir $(NAN_ACTION) + @[ -d $(NAN_ACTION)/include ] || mkdir $(NAN_ACTION)/include + @[ -d $(NAN_ACTION)/lib ] || mkdir $(NAN_ACTION)/lib + @[ -d $(NAN_ACTION)/lib/debug ] || mkdir $(NAN_ACTION)/lib/debug + cp -f $(DIR)/libaction.a $(NAN_ACTION)/lib/ + cp -f $(DIR)/debug/libaction.a $(NAN_ACTION)/lib/debug/ + cp -f *.h $(NAN_ACTION)/include/ + diff --git a/intern/action/doc/Doxyfile b/intern/action/doc/Doxyfile new file mode 100644 index 00000000000..2cc9de2d97c --- /dev/null +++ b/intern/action/doc/Doxyfile @@ -0,0 +1,746 @@ +# Doxyfile 1.2.4 + +# This file describes the settings to be used by doxygen for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. +PROJECT_NAME = foundation + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, +# Korean, Hungarian, Norwegian, Spanish, Romanian, Russian, Croatian, +# Polish, Portuguese and Slovene. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. + +CLASS_DIAGRAMS = YES + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The ENABLE_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../extern ../intern + + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +FILE_PATTERNS = *.h *.cpp *.c + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse. + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side pannel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript and frames is required (for instance Netscape 4.0+ +# or Internet explorer 4.0+). + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using a WORD or other. +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. Warning: This feature +# is still experimental and very incomplete. + +GENERATE_XML = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = ../../generic/extern + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented file showing +# the direct and indirect include dependencies of the file with other +# documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented header file showing +# the documented files that directly or indirectly include this file + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = search.cgi + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = c:\program files\doxygen\bin + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/intern/action/intern/ACT_Action.cpp b/intern/action/intern/ACT_Action.cpp new file mode 100644 index 00000000000..ff3c01d146d --- /dev/null +++ b/intern/action/intern/ACT_Action.cpp @@ -0,0 +1,64 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date April, 25, 2001 + */ + +#include "ACT_Action.h" + + +ACT_Action::ACT_Action(const STR_String& name, bool applied) +: m_name(name), m_applied(applied) +{ +} + + +void ACT_Action::apply() +{ + if (!m_applied) { + doApply(); + m_applied = true; + } +} + + +void ACT_Action::undo() +{ + if (m_applied) { + doUndo(); + m_applied = false; + } +} diff --git a/intern/action/intern/ACT_ActionC-Api.cpp b/intern/action/intern/ACT_ActionC-Api.cpp new file mode 100644 index 00000000000..1c2defa333a --- /dev/null +++ b/intern/action/intern/ACT_ActionC-Api.cpp @@ -0,0 +1,130 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date April, 25, 2001 + */ + +#include "ACT_ActionC-Api.h" + +#include "ACT_ActionStack.h" +#include "ACT_CallbackAction.h" + + +ACT_ActionPtr ACT_ActionCreate( + char* name, + int isApplied, + ACT_ActionUserDataPtr data, + ACT_ActionApplyProcPtr applyProc, + ACT_ActionUndoProcPtr undoProc, + ACT_ActionDisposeProcPtr disposeProc) +{ + STR_String tmp (name); + ACT_CallbackAction* action = new ACT_CallbackAction(tmp, isApplied != 0, data, applyProc, undoProc, disposeProc); + return (ACT_ActionPtr) action; +} + + +char* ACT_ActionGetName(ACT_ActionPtr action) +{ + return action ? ((ACT_Action*)action)->getName() : 0; +} + + +ACT_ActionStackPtr ACT_ActionStackCreate(unsigned int stackSize) +{ + return ((ACT_ActionStackPtr) (new ACT_ActionStack (stackSize))); +} + + +void ACT_ActionStackDispose(ACT_ActionStackPtr stack) +{ + if (stack) { + delete (ACT_ActionStack*) stack; + } +} + + +unsigned int ACT_ActionStackGetStackDepth(ACT_ActionStackPtr stack) +{ + return stack ? ((ACT_ActionStack*)stack)->getStackDepth() : 0; +} + +unsigned int ACT_ActionStackGetMaxStackDepth(ACT_ActionStackPtr stack) +{ + return stack ? ((ACT_ActionStack*)stack)->getMaxStackDepth() : 0; +} + +void ACT_ActionStackSetMaxStackDepth(ACT_ActionStackPtr stack, unsigned int maxStackDepth) +{ + if (stack) { + ((ACT_ActionStack*)stack)->setMaxStackDepth(maxStackDepth); + } +} + +void ACT_ActionStackPush(ACT_ActionStackPtr stack, ACT_ActionPtr action) +{ + if (stack && action) { + ((ACT_ActionStack*)stack)->push(*((ACT_Action*)action)); + } +} + + +ACT_ActionStackPtr ACT_ActionStackPeekUndo(ACT_ActionStackPtr stack) +{ + return (ACT_ActionStackPtr) (stack ? ((ACT_ActionStack*)stack)->peekUndo() : 0); +} + + +ACT_ActionStackPtr ACT_ActionStackPeekRedo(ACT_ActionStackPtr stack) +{ + return (ACT_ActionStackPtr) (stack ? ((ACT_ActionStack*)stack)->peekRedo() : 0); +} + + +void ACT_ActionStackUndo(ACT_ActionStackPtr stack) +{ + if (stack) { + ((ACT_ActionStack*)stack)->undo(); + } +} + + +void ACT_ActionStackRedo(ACT_ActionStackPtr stack) +{ + if (stack) { + ((ACT_ActionStack*)stack)->redo(); + } +} diff --git a/intern/action/intern/ACT_ActionStack.cpp b/intern/action/intern/ACT_ActionStack.cpp new file mode 100644 index 00000000000..569babd95f2 --- /dev/null +++ b/intern/action/intern/ACT_ActionStack.cpp @@ -0,0 +1,241 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +#include "ACT_ActionStack.h" + + +ACT_ActionStack::ACT_ActionStack(unsigned int maxStackDepth) + : m_maxStackDepth(maxStackDepth), + m_undoIndex(0), m_undoIndexValid(false), + m_redoIndex(0), m_redoIndexValid(false) +{ +} + + +ACT_ActionStack::~ACT_ActionStack() +{ + flush(); +} + + +unsigned int ACT_ActionStack::getStackDepth() const +{ + return m_stack.size(); +} + + +unsigned int ACT_ActionStack::getMaxStackDepth() const +{ + return m_maxStackDepth; +} + + +void ACT_ActionStack::setMaxStackDepth(unsigned int maxStackDepth) +{ + if (maxStackDepth != m_maxStackDepth) { + if (maxStackDepth) { + unsigned int size = m_stack.size(); + if (maxStackDepth < size) { + // New max stack size is smaller than current stack size, need to shrink stack + unsigned int numRemove = size - maxStackDepth; + if (m_undoIndex >= maxStackDepth) { + // Pop items from the front (throw away undo steps) + popFront(numRemove); + m_undoIndex -= numRemove; + m_redoIndex = m_undoIndex + 1; + m_redoIndexValid = m_redoIndexValid && (maxStackDepth > 1); + } + else { + // Pop items from the back (throw away redo steps) + popBack(numRemove); + m_redoIndexValid = m_redoIndexValid && (m_redoIndex < maxStackDepth); + } + } + } + else { + // New stack size is zero + flush(); + } + m_maxStackDepth = maxStackDepth; + } +} + + +void ACT_ActionStack::push(ACT_Action& action) +{ + if (m_maxStackDepth) { + unsigned int size = m_stack.size(); + if (m_redoIndexValid) { + // Remove items after the current action (throw away redo steps) + popBack(size - m_redoIndex); + } + else if (size >= m_maxStackDepth) { + // Remove items from the front (throw away undo steps) + popFront(m_maxStackDepth - size + 1); + } + + // Store the action + if (!action.getIsApplied()) { + action.apply(); + } + action.incRef(); + m_stack.push_back(&action); + + // Update action indices + m_redoIndex = m_stack.size(); + m_redoIndexValid = false; + m_undoIndex = m_redoIndex - 1; + m_undoIndexValid = true; + } +} + + +ACT_Action* ACT_ActionStack::peekUndo() +{ + unsigned int i; + return getUndoIndex(i) ? m_stack[i] : 0; +} + + +ACT_Action* ACT_ActionStack::peekRedo() +{ + unsigned int i; + return getRedoIndex(i) ? m_stack[i] : 0; +} + + +void ACT_ActionStack::flush() +{ + popBack(m_stack.size()); + m_undoIndex = 0; + m_undoIndexValid = false; + m_redoIndex = 0; + m_redoIndexValid = false; +} + + +bool ACT_ActionStack::canUndo() const +{ + unsigned int i; + return getUndoIndex(i); +} + + +void ACT_ActionStack::undo() +{ + ACT_Action* action = peekUndo(); + if (action) { + action->undo(); + + // Update action indices + m_redoIndex = m_undoIndex; + m_redoIndexValid = true; + if (m_undoIndex) { + m_undoIndex--; + } + else { + m_undoIndexValid = false; + } + } +} + + +bool ACT_ActionStack::canRedo() const +{ + unsigned int i; + return getRedoIndex(i); +} + + +void ACT_ActionStack::redo() +{ + ACT_Action* action = peekRedo(); + if (action) { + action->apply(); + + // Update action indices + m_undoIndex = m_redoIndex; + m_undoIndexValid = true; + m_redoIndex++; + m_redoIndexValid = m_redoIndex < m_stack.size(); + } +} + + +unsigned int ACT_ActionStack::popFront(unsigned int numActions) +{ + unsigned int numRemoved = 0; + + while (numActions-- && m_stack.size()) { + ACT_Action* action = m_stack[0]; + action->decRef(); + m_stack.pop_front(); + numRemoved++; + } + return numRemoved; +} + + +unsigned int ACT_ActionStack::popBack(unsigned int numActions) +{ + unsigned int numRemoved = 0; + unsigned int size; + + while (numActions-- && (size = m_stack.size())) { + ACT_Action* action = m_stack[size-1]; + action->decRef(); + m_stack.pop_back(); + numRemoved++; + } + return numRemoved; +} + + +bool ACT_ActionStack::getUndoIndex(unsigned int& i) const +{ + i = m_undoIndex; + return m_undoIndexValid; +} + + +bool ACT_ActionStack::getRedoIndex(unsigned int& i) const +{ + i = m_redoIndex; + return m_redoIndexValid; +} diff --git a/intern/action/intern/ACT_CallbackAction.h b/intern/action/intern/ACT_CallbackAction.h new file mode 100644 index 00000000000..e03e4048808 --- /dev/null +++ b/intern/action/intern/ACT_CallbackAction.h @@ -0,0 +1,124 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date June 17, 2001 + */ + +#ifndef _H_ACT_CALLBACK_ACTION_H +#define _H_ACT_CALLBACK_ACTION_H + +#include "ACT_Action.h" +#include "ACT_ActionC-Api.h" + + +/** + * An action implementation that uses callbacks for undo and redo. + * @author Maarten Gribnau + * @date June 17, 2001 + */ + +class ACT_CallbackAction : public ACT_Action { +public: + /** + * Constructs an action with the given name . + * @param name The name of the action. + * @param applied State of the action after creation. + * @param data Pointer to user data passed to the callbacks. + * @param applyProc Callback invoked for apply action. + * @param undoProc Callback invoked for undo action. + */ + ACT_CallbackAction( + STR_String& name, + bool applied, + ACT_ActionUserDataPtr data, + ACT_ActionApplyProcPtr applyProc, + ACT_ActionUndoProcPtr undoProc, + ACT_ActionDisposeProcPtr disposeProc) + : ACT_Action(name, applied), m_userData(data), m_applyProc(applyProc), m_undoProc(undoProc), m_disposeProc(disposeProc) + { + } + + /** + * Default destructor. + * Will call the dispose callback. + */ + virtual ~ACT_CallbackAction() + { + // Should assert + m_disposeProc((ACT_ActionPtr)this, m_userData); + } + + +protected: + /** + * Calls the appropriate callback. + */ + inline virtual void doApply(); + + /** + * Calls the appropriate callback. + */ + inline virtual void doUndo(); + + /** User data supplied at creation and passed to the callbacks. */ + ACT_ActionUserDataPtr m_userData; + + /** Callback invoked for apply action. */ + ACT_ActionApplyProcPtr m_applyProc; + + /** Callback invoked for undo action. */ + ACT_ActionApplyProcPtr m_undoProc; + + /** Callback invoked when the action is disposed. */ + ACT_ActionDisposeProcPtr m_disposeProc; +}; + + +inline void ACT_CallbackAction::doApply() +{ + // Should assert + m_applyProc((ACT_ActionPtr)this, m_userData); +} + + +inline void ACT_CallbackAction::doUndo() +{ + // Should assert + m_undoProc((ACT_ActionPtr)this, m_userData); +} + + +#endif // _H_ACT_CALLBACK_ACTION_H
\ No newline at end of file diff --git a/intern/action/intern/Makefile b/intern/action/intern/Makefile new file mode 100644 index 00000000000..29f82bb7c0d --- /dev/null +++ b/intern/action/intern/Makefile @@ -0,0 +1,42 @@ +# +# $Id$ +# +# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** +# +# 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 +# of the License, or (at your option) any later version. The Blender +# Foundation also sells licenses for use in proprietary software under +# the Blender License. See http://www.blender.org/BL/ for information +# about this. +# +# 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, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. +# All rights reserved. +# +# The Original Code is: all of this file. +# +# Contributor(s): none yet. +# +# ***** END GPL/BL DUAL LICENSE BLOCK ***** +# action intern Makefile +# + +LIBNAME = action +DIR = $(OCGDIR)/intern/$(LIBNAME) + +include nan_compile.mk + +CPPFLAGS += -I.. +CPPFLAGS += -I$(NAN_STRING)/include +CPPFLAGS += -I$(NAN_MEMUTIL)/include + diff --git a/intern/action/make/msvc_6_0/action.dsp b/intern/action/make/msvc_6_0/action.dsp new file mode 100644 index 00000000000..3ea450b19a7 --- /dev/null +++ b/intern/action/make/msvc_6_0/action.dsp @@ -0,0 +1,128 @@ +# Microsoft Developer Studio Project File - Name="action" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=action - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "action.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "action.mak" CFG="action - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "action - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "action - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "action - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../../../obj/windows/intern/action/" +# PROP Intermediate_Dir "../../../../../obj/windows/intern/action/" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "../.." /I "../../../../lib/windows/memutil/include/" /I "../../../../lib/windows/string/include/" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "action - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../../../obj/windows/intern/action/debug" +# PROP Intermediate_Dir "../../../../../obj/windows/intern/action/debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../.." /I "../../../../lib/windows/memutil/include/" /I "../../../../lib/windows/string/include/" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "action - Win32 Release" +# Name "action - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\intern\ACT_Action.cpp +# End Source File +# Begin Source File + +SOURCE="..\..\intern\ACT_ActionC-Api.cpp" +# End Source File +# Begin Source File + +SOURCE=..\..\intern\ACT_ActionStack.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Group "intern" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\intern\ACT_CallbackAction.h +# End Source File +# End Group +# Begin Group "extern" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\ACT_Action.h +# End Source File +# Begin Source File + +SOURCE="..\..\ACT_ActionC-Api.h" +# End Source File +# Begin Source File + +SOURCE=..\..\ACT_ActionStack.h +# End Source File +# End Group +# End Group +# End Target +# End Project diff --git a/intern/action/make/msvc_6_0/action.dsw b/intern/action/make/msvc_6_0/action.dsw new file mode 100644 index 00000000000..f93cbb896fd --- /dev/null +++ b/intern/action/make/msvc_6_0/action.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "action"=".\action.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/intern/action/test/action_c_test/ActionTest.c b/intern/action/test/action_c_test/ActionTest.c new file mode 100644 index 00000000000..a30163e0c3b --- /dev/null +++ b/intern/action/test/action_c_test/ActionTest.c @@ -0,0 +1,83 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +#include "ACT_ActionC-Api.h" +#include "TestAction.h" + +int main(int argc, char *argv[]) +{ + ACT_ActionStackPtr stack = ACT_ActionStackCreate (3); + ACT_ActionPtr action = ACT_ActionCreate("action1", 0, 0, printApplied, printUndone, printDisposed); + ACT_ActionStackPush(stack, action); + MEM_RefCountedDecRef(action); + action = ACT_ActionCreate("action2", 0, 0, printApplied, printUndone, printDisposed); + ACT_ActionStackPush(stack, action); + MEM_RefCountedDecRef(action); + action = ACT_ActionCreate("action3", 0, 0, printApplied, printUndone, printDisposed); + ACT_ActionStackPush(stack, action); + MEM_RefCountedDecRef(action); + + ACT_ActionStackUndo(stack); + ACT_ActionStackUndo(stack); + ACT_ActionStackUndo(stack); + ACT_ActionStackRedo(stack); + ACT_ActionStackRedo(stack); + ACT_ActionStackRedo(stack); + + ACT_ActionStackSetMaxStackDepth(stack, 1); + ACT_ActionStackUndo(stack); + ACT_ActionStackRedo(stack); + ACT_ActionStackSetMaxStackDepth(stack, 5); + ACT_ActionStackUndo(stack); + ACT_ActionStackRedo(stack); + + action = ACT_ActionCreate("action4", 0, 0, printApplied, printUndone, printDisposed); + ACT_ActionStackPush(stack, action); + MEM_RefCountedDecRef(action); + ACT_ActionStackUndo(stack); + action = ACT_ActionCreate("action5", 0, 0, printApplied, printUndone, printDisposed); + ACT_ActionStackPush(stack, action); + MEM_RefCountedDecRef(action); + ACT_ActionStackUndo(stack); + ACT_ActionStackUndo(stack); + ACT_ActionStackRedo(stack); + ACT_ActionStackRedo(stack); + + return 0; +}
\ No newline at end of file diff --git a/intern/action/test/action_c_test/TestAction.c b/intern/action/test/action_c_test/TestAction.c new file mode 100644 index 00000000000..7b9739495d0 --- /dev/null +++ b/intern/action/test/action_c_test/TestAction.c @@ -0,0 +1,59 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +#include <stdio.h> + +#include "TestAction.h" + + +void printApplied(ACT_ActionPtr action, ACT_ActionUserDataPtr userData) +{ + printf("%s: applied\n", ACT_ActionGetName(action)); +} + +void printUndone(ACT_ActionPtr action, ACT_ActionUserDataPtr userData) +{ + printf("%s: undone\n", ACT_ActionGetName(action)); +} + + +void printDisposed(ACT_ActionPtr action, ACT_ActionUserDataPtr userData) +{ + printf("%s: disposed\n", ACT_ActionGetName(action)); +} diff --git a/intern/action/test/action_c_test/TestAction.h b/intern/action/test/action_c_test/TestAction.h new file mode 100644 index 00000000000..7abf0be6919 --- /dev/null +++ b/intern/action/test/action_c_test/TestAction.h @@ -0,0 +1,50 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +#ifndef _H_ACT_TESTACTION_C_H_ +#define _H_ACT_TESTACTION_C_H_ + +#include "ACT_ActionC-Api.h" + +void printApplied(ACT_ActionPtr action, ACT_ActionUserDataPtr userData); +void printUndone(ACT_ActionPtr action, ACT_ActionUserDataPtr userData); +void printDisposed(ACT_ActionPtr action, ACT_ActionUserDataPtr userData); + + +#endif // _H_ACT_TESTACTION_C_H_
\ No newline at end of file diff --git a/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsp b/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsp new file mode 100644 index 00000000000..807024f20be --- /dev/null +++ b/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsp @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Project File - Name="action_c_test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=action_c_test - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "action_c_test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "action_c_test.mak" CFG="action_c_test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "action_c_test - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "action_c_test - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "action_c_test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../../../../../obj/windows/intern/action/test" +# PROP Intermediate_Dir "../../../../../../../obj/windows/intern/action/test" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "../../../.." /I "../../../../../../lib/windows/memutil/include/" /I "../../../../../../lib/windows/string/include/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib string.lib memutil.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../../../../lib/windows/memutil/lib" /libpath:"../../../../../../lib/windows/string/lib" + +!ELSEIF "$(CFG)" == "action_c_test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../../../../../obj/windows/intern/action/test/debug" +# PROP Intermediate_Dir "../../../../../../../obj/windows/intern/action/test/debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../.." /I "../../../../../../lib/windows/memutil/include/" /I "../../../../../../lib/windows/string/include/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib string.lib memutil.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../../../../lib/windows/memutil/lib/debug" /libpath:"../../../../../../lib/windows/string/lib/debug" + +!ENDIF + +# Begin Target + +# Name "action_c_test - Win32 Release" +# Name "action_c_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\ActionTest.c +# End Source File +# Begin Source File + +SOURCE=..\..\TestAction.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\TestAction.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsw b/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsw new file mode 100644 index 00000000000..688f24e4d53 --- /dev/null +++ b/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsw @@ -0,0 +1,44 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "action"="..\..\..\..\make\msvc_6_0\action.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "action_c_test"=".\action_c_test.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name action + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/intern/action/test/action_cpp_test/ActionTest.cpp b/intern/action/test/action_cpp_test/ActionTest.cpp new file mode 100644 index 00000000000..379cc41a5de --- /dev/null +++ b/intern/action/test/action_cpp_test/ActionTest.cpp @@ -0,0 +1,83 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +#include "ACT_ActionStack.h" +#include "TestAction.h" + +int main() +{ + ACT_ActionStack testStack (3); + TestAction* testAction = new TestAction (STR_String("action1")); + testStack.push(*testAction); + testAction->decRef(); + testAction = new TestAction (STR_String("action2")); + testStack.push(*testAction); + testAction->decRef(); + testAction = new TestAction (STR_String("action3")); + testStack.push(*testAction); + testAction->decRef(); + + testStack.undo(); + testStack.undo(); + testStack.undo(); + testStack.redo(); + testStack.redo(); + testStack.redo(); + + testStack.setMaxStackDepth(1); + testStack.undo(); + testStack.redo(); + testStack.setMaxStackDepth(5); + testStack.undo(); + testStack.redo(); + + testAction = new TestAction (STR_String("action4")); + testStack.push(*testAction); + testAction->decRef(); + testStack.undo(); + testAction = new TestAction (STR_String("action5")); + testStack.push(*testAction); + testAction->decRef(); + testStack.undo(); + testStack.undo(); + testStack.redo(); + testStack.redo(); + + return 0; +}
\ No newline at end of file diff --git a/intern/action/test/action_cpp_test/TestAction.h b/intern/action/test/action_cpp_test/TestAction.h new file mode 100644 index 00000000000..83bc8fb1750 --- /dev/null +++ b/intern/action/test/action_cpp_test/TestAction.h @@ -0,0 +1,57 @@ +/** + * $Id$ + * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. The Blender + * Foundation also sells licenses for use in proprietary software under + * the Blender License. See http://www.blender.org/BL/ for information + * about this. + * + * 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, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** + + * $Id$ + * Copyright (C) 2001 NaN Technologies B.V. + * @author Maarten Gribnau + * @date March 31, 2001 + */ + +#ifndef _H_ACT_TESTACTION +#define _H_ACT_TESTACTION + +#include "ACT_Action.h" + +#include <iostream> + +class TestAction : public ACT_Action +{ +public: + TestAction(const STR_String& name) : ACT_Action(name) {} + virtual ~TestAction() { cout << m_name.Ptr() << ": deleted\n"; } +protected: + virtual void doApply() { cout << m_name.Ptr() << ": applied\n"; } + virtual void doUndo() { cout << m_name.Ptr() << ": undone\n"; } +}; + +#endif // _H_ACT_TESTACTION
\ No newline at end of file diff --git a/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsp b/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsp new file mode 100644 index 00000000000..bc0c40b6d36 --- /dev/null +++ b/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsp @@ -0,0 +1,105 @@ +# Microsoft Developer Studio Project File - Name="action_cpp_test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=action_cpp_test - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "action_cpp_test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "action_cpp_test.mak" CFG="action_cpp_test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "action_cpp_test - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "action_cpp_test - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "action_cpp_test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../../../../../obj/windows/intern/action/test" +# PROP Intermediate_Dir "../../../../../../../obj/windows/intern/action/test" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "../../../.." /I "../../../../../../lib/windows/memutil/include/" /I "../../../../../../lib/windows/string/include/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib string.lib memutil.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../../../../lib/windows/memutil/lib" /libpath:"../../../../../../lib/windows/string/lib" + +!ELSEIF "$(CFG)" == "action_cpp_test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../../../../../obj/windows/intern/action/test/debug" +# PROP Intermediate_Dir "../../../../../../../obj/windows/intern/action/test/debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../.." /I "../../../../../../lib/windows/memutil/include/" /I "../../../../../../lib/windows/string/include/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib string.lib memutil.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../../../../lib/windows/memutil/lib/debug" /libpath:"../../../../../../lib/windows/string/lib/debug" + +!ENDIF + +# Begin Target + +# Name "action_cpp_test - Win32 Release" +# Name "action_cpp_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\ActionTest.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\TestAction.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsw b/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsw new file mode 100644 index 00000000000..0a9d7374379 --- /dev/null +++ b/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsw @@ -0,0 +1,44 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "action"="..\..\..\..\make\msvc_6_0\action.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "action_cpp_test"=".\action_cpp_test.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name action + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + |