Changeset 208

Show
Ignore:
Timestamp:
03/16/08 04:42:56 (4 months ago)
Author:
mattn
Message:

* added filter api to create new filters from within plugins
* TTimo, please have a look at the mainframe.cpp part

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • GtkRadiant/branches/ZeroRadiant/plugins/sample/plugin.cpp

    r206 r208  
    2222#include "plugin.h" 
    2323 
    24 #define CMD_SEP "-" 
     24#define CMD_SEP "-"  
    2525#define CMD_ABOUT "About..." 
    2626// ============================================================================= 
     
    6161} toolbar_button_info_t; 
    6262 
    63 static const toolbar_button_info_t toolbar_buttons[NUM_TOOLBAR_BUTTONS] = 
     63static const toolbar_button_info_t toolbar_buttons[NUM_TOOLBAR_BUTTONS] =  
    6464{ 
    6565        { 
    6666                "sample.bmp", 
    6767                "Sample", 
    68       "Sample image", 
     68              "Sample image", 
    6969                DoSample, 
    7070                IToolbarButton::eToggleButton 
     
    147147#pragma GCC visibility push(default) 
    148148#endif 
    149 extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const char *version, CSynapseServer *pServer) 
     149extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const char *version, CSynapseServer *pServer)  
    150150{ 
    151151#if __GNUC__ >= 4 
     
    162162        g_SynapseClient.AddAPI(TOOLBAR_MAJOR, SAMPLE_MINOR, sizeof(_QERPlugToolbarTable)); 
    163163        g_SynapseClient.AddAPI(PLUGIN_MAJOR, SAMPLE_MINOR, sizeof(_QERPluginTable)); 
    164  
     164         
    165165        g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable); 
    166166        g_SynapseClient.AddAPI(QGL_MAJOR, NULL, sizeof(g_QglTable), SYN_REQUIRE, &g_QglTable); 
     
    178178        if (!strcmp(pAPI->major_name, PLUGIN_MAJOR)) { 
    179179                _QERPluginTable* pTable= static_cast<_QERPluginTable*>(pAPI->mpTable); 
    180  
     180         
    181181                pTable->m_pfnQERPlug_Init = QERPlug_Init; 
    182182                pTable->m_pfnQERPlug_GetName = QERPlug_GetName; 
     
    186186        } else if (!strcmp(pAPI->major_name, TOOLBAR_MAJOR)) { 
    187187                _QERPlugToolbarTable* pTable= static_cast<_QERPlugToolbarTable*>(pAPI->mpTable); 
    188  
     188         
    189189                pTable->m_pfnToolbarButtonCount = &ToolbarButtonCount; 
    190190                pTable->m_pfnGetToolbarButton = &GetToolbarButton; 
    191191                return true; 
    192192        } 
    193  
     193         
    194194        Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo()); 
    195195        return false; 
  • GtkRadiant/branches/ZeroRadiant/radiant/filters.cpp

    r197 r208  
    3131#include "stdafx.h" 
    3232 
     33// type 1 = texture filter (name) 
     34// type 3 = entity filter (name) 
     35// type 2 = QER_* shader flags 
     36// type 4 = entity classes 
    3337bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude) 
    3438{ 
     
    4347                pNew->active = false; 
    4448        return pNew; 
     49} 
     50 
     51bfilter_t *FilterCreate (int type, int bmask, char *str, int exclude) 
     52{ 
     53        g_qeglobals.d_savedinfo.filters = FilterAdd(g_qeglobals.d_savedinfo.filters, type, bmask, str, exclude); 
     54        Syn_Printf("Added filter %s (type: %i, bmask: %i, exclude: %i)\n", str, type, bmask, exclude); 
     55        return g_qeglobals.d_savedinfo.filters; 
     56} 
     57 
     58extern void PerformFiltering(); 
     59 
     60void FiltersActivate (void) 
     61{ 
     62        PerformFiltering(); 
     63        Sys_UpdateWindows(W_XY|W_CAMERA); 
    4564} 
    4665 
  • GtkRadiant/branches/ZeroRadiant/radiant/filters.h

    r183 r208  
    2323#define _FILTERS_H_ 
    2424 
     25void FiltersActivate(void); 
     26bfilter_t *FilterCreate(int type, int bmask, char *str, int exclude); 
    2527bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude); 
    2628bfilter_t *FilterListDelete(bfilter_t *pFilter); 
  • GtkRadiant/branches/ZeroRadiant/radiant/mainframe.cpp

    r200 r208  
    74757475  brush_t *brush; 
    74767476 
     7477  // mattn - this should be removed - otherwise the filters from the  
     7478  // plugins are wiped away with each update 
     7479#if 1 
    74777480  // spog - deletes old filters list and creates new one when 
    74787481  // g_qeglobals.d_savedinfo.exclude is updated 
    74797482  g_qeglobals.d_savedinfo.filters = FilterListDelete(g_qeglobals.d_savedinfo.filters); 
    74807483  g_qeglobals.d_savedinfo.filters = FilterUpdate(g_qeglobals.d_savedinfo.filters); 
     7484#endif 
    74817485 
    74827486  for ( brush = active_brushes.next; brush != &active_brushes; brush = brush->next ) 
  • GtkRadiant/branches/ZeroRadiant/radiant/pluginmanager.cpp

    r185 r208  
    4444#include "plugin.h" 
    4545#include "missing.h" 
     46#include "filters.h" 
    4647 
    4748#include "version.h" 
     
    22292230    pTable->m_pfnReadProjectKey = &QERApp_ReadProjectKey; 
    22302231    pTable->m_pfnGetMapName = &QERApp_GetMapName; 
     2232    pTable->m_pfnFilterAdd = &FilterCreate; 
     2233    pTable->m_pfnFiltersActivate = &FiltersActivate; 
    22312234 
    22322235    return true;