Commit 8be73ad0 authored by Maciej Suminski's avatar Maciej Suminski

KiCad assistant.

parent a6172bb7
...@@ -581,6 +581,7 @@ set( BMAPS_OTHER ...@@ -581,6 +581,7 @@ set( BMAPS_OTHER
tune_diff_pair_length_legend tune_diff_pair_length_legend
tune_diff_pair_skew_legend tune_diff_pair_skew_legend
tune_single_track_length_legend tune_single_track_length_legend
paperclip
) )
......
This diff is collapsed.
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <dialogs/dialog_assistant.h>
///> Stores information about a mouse button state ///> Stores information about a mouse button state
struct TOOL_DISPATCHER::BUTTON_STATE struct TOOL_DISPATCHER::BUTTON_STATE
{ {
...@@ -330,7 +332,12 @@ void TOOL_DISPATCHER::DispatchWxCommand( wxCommandEvent& aEvent ) ...@@ -330,7 +332,12 @@ void TOOL_DISPATCHER::DispatchWxCommand( wxCommandEvent& aEvent )
boost::optional<TOOL_EVENT> evt = COMMON_ACTIONS::TranslateLegacyId( aEvent.GetId() ); boost::optional<TOOL_EVENT> evt = COMMON_ACTIONS::TranslateLegacyId( aEvent.GetId() );
if( evt ) if( evt )
{
PCB_EDIT_FRAME*frame = dynamic_cast<PCB_EDIT_FRAME*>( m_toolMgr->GetEditFrame() );
if(frame)
frame->GetAssistant()->RandomHint( KICAD_ASSISTANT::TIP_OF_THE_DAY, 6000, 10 );
m_toolMgr->ProcessEvent( *evt ); m_toolMgr->ProcessEvent( *evt );
}
else else
aEvent.Skip(); aEvent.Skip();
} }
...@@ -396,6 +396,7 @@ EXTERN_BITMAP( options_track_xpm ) ...@@ -396,6 +396,7 @@ EXTERN_BITMAP( options_track_xpm )
EXTERN_BITMAP( options_vias_xpm ) EXTERN_BITMAP( options_vias_xpm )
EXTERN_BITMAP( opt_show_polygon_xpm ) EXTERN_BITMAP( opt_show_polygon_xpm )
EXTERN_BITMAP( orient_xpm ) EXTERN_BITMAP( orient_xpm )
EXTERN_BITMAP( paperclip_xpm )
EXTERN_BITMAP( pad_sketch_xpm ) EXTERN_BITMAP( pad_sketch_xpm )
EXTERN_BITMAP( pad_xpm ) EXTERN_BITMAP( pad_xpm )
EXTERN_BITMAP( pad_dimensions_xpm ) EXTERN_BITMAP( pad_dimensions_xpm )
......
...@@ -64,6 +64,7 @@ class REPORTER; ...@@ -64,6 +64,7 @@ class REPORTER;
struct PARSE_ERROR; struct PARSE_ERROR;
struct IO_ERROR; struct IO_ERROR;
class FP_LIB_TABLE; class FP_LIB_TABLE;
class KICAD_ASSISTANT;
namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
...@@ -1729,6 +1730,10 @@ public: ...@@ -1729,6 +1730,10 @@ public:
*/ */
void UpdateTitle(); void UpdateTitle();
KICAD_ASSISTANT* GetAssistant() { return m_assistant; }
KICAD_ASSISTANT* m_assistant;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -41,6 +41,7 @@ include_directories( ...@@ -41,6 +41,7 @@ include_directories(
) )
set( PCBNEW_DIALOGS set( PCBNEW_DIALOGS
dialogs/dialog_assistant.cpp
dialogs/dialog_block_options_base.cpp dialogs/dialog_block_options_base.cpp
dialogs/dialog_cleaning_options_base.cpp dialogs/dialog_cleaning_options_base.cpp
dialogs/dialog_cleaning_options.cpp dialogs/dialog_cleaning_options.cpp
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
#include <tools/selection_tool.h> #include <tools/selection_tool.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <dialogs/dialog_assistant.h>
/* Functions to undo and redo edit commands. /* Functions to undo and redo edit commands.
* commands to undo are stored in CurrentScreen->m_UndoList * commands to undo are stored in CurrentScreen->m_UndoList
* commands to redo are stored in CurrentScreen->m_RedoList * commands to redo are stored in CurrentScreen->m_RedoList
...@@ -640,6 +642,9 @@ void PCB_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent ) ...@@ -640,6 +642,9 @@ void PCB_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
TOOL_EVENT event( TC_MESSAGE, TA_UNDO_REDO, AS_GLOBAL ); TOOL_EVENT event( TC_MESSAGE, TA_UNDO_REDO, AS_GLOBAL );
m_toolManager->ProcessEvent( event ); m_toolManager->ProcessEvent( event );
if( IsGalCanvasActive() )
GetAssistant()->RandomHint( KICAD_ASSISTANT::UNDO, 6000, 10 );
/* Get the old list */ /* Get the old list */
PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromUndoList(); PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromUndoList();
/* Undo the command */ /* Undo the command */
......
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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.
*
* 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, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __DIALOG_ASSISTANT_H__
#define __DIALOG_ASSISTANT_H__
#include <map>
#include <vector>
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/dialog.h>
#include <wx/frame.h>
#define ASSISTANT_STYLE wxFRAME_TOOL_WINDOW|wxSTAY_ON_TOP|wxFRAME_NO_TASKBAR|wxCLOSE_BOX
class HINT;
class KICAD_ASSISTANT : public wxFrame
{
public:
enum HINT_CATEGORY { WELCOME, TIP_OF_THE_DAY, ROUTING, UNDO, MOVING };
KICAD_ASSISTANT( wxWindow* parent, wxWindowID id = wxID_ANY,
const wxString& title = wxT("KiCad Assistant"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = ASSISTANT_STYLE|wxCAPTION );
~KICAD_ASSISTANT();
void DisplayHint( const wxString& aMsg, int aTimeout = 0, int aChance = 100 );
void RandomHint( HINT_CATEGORY aCategory, int aTimeout = 0, int aChance = 100 );
void OnClose(wxCloseEvent& event);
void OnMove(wxMoveEvent& event);
void onButton( wxMouseEvent& aEvent );
private:
protected:
wxStaticBitmap* m_imgPaperclip;
std::map<HINT_CATEGORY, std::vector<wxString> > m_hints;
HINT* m_hint;
wxWindow* m_parent;
};
#endif //__DIALOG_ASSISTANT_H__
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <dialog_helpers.h> #include <dialog_helpers.h>
#include <dialog_plot.h> #include <dialog_plot.h>
#include <dialog_assistant.h>
#include <convert_from_iu.h> #include <convert_from_iu.h>
#include <view/view.h> #include <view/view.h>
#include <view/view_controls.h> #include <view/view_controls.h>
...@@ -453,6 +454,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ...@@ -453,6 +454,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
setupTools(); setupTools();
Zoom_Automatique( false ); Zoom_Automatique( false );
m_assistant = new KICAD_ASSISTANT( this );
m_assistant->Show();
m_assistant->RandomHint( KICAD_ASSISTANT::WELCOME, 10000 );
} }
...@@ -697,6 +702,7 @@ void PCB_EDIT_FRAME::SwitchCanvas( wxCommandEvent& aEvent ) ...@@ -697,6 +702,7 @@ void PCB_EDIT_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
case ID_MENU_CANVAS_OPENGL: case ID_MENU_CANVAS_OPENGL:
use_gal = GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ); use_gal = GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
GetAssistant()->DisplayHint( "Wooow! OpenGL!\nThat's cool, it was not here the last time..", 5000 );
break; break;
} }
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include "pns_router.h" #include "pns_router.h"
#include "trace.h" #include "trace.h"
#include <dialogs/dialog_assistant.h>
using namespace KIGFX; using namespace KIGFX;
using boost::optional; using boost::optional;
...@@ -514,6 +516,8 @@ void ROUTER_TOOL::performRouting() ...@@ -514,6 +516,8 @@ void ROUTER_TOOL::performRouting()
updateEndItem( *evt ); updateEndItem( *evt );
bool needLayerSwitch = m_router->IsPlacingVia(); bool needLayerSwitch = m_router->IsPlacingVia();
m_frame->GetAssistant()->RandomHint( KICAD_ASSISTANT::ROUTING, 6000, 10 );
if( m_router->FixRoute( m_endSnapPoint, m_endItem ) ) if( m_router->FixRoute( m_endSnapPoint, m_endItem ) )
break; break;
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <dialogs/dialog_create_array.h> #include <dialogs/dialog_create_array.h>
#include <dialogs/dialog_move_exact.h> #include <dialogs/dialog_move_exact.h>
#include <dialogs/dialog_assistant.h>
EDIT_TOOL::EDIT_TOOL() : EDIT_TOOL::EDIT_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ), TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
...@@ -248,6 +249,9 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent ) ...@@ -248,6 +249,9 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
} }
else // Prepare to start dragging else // Prepare to start dragging
{ {
if( !m_editModules )
static_cast<PCB_EDIT_FRAME*>( editFrame )->GetAssistant()->RandomHint( KICAD_ASSISTANT::MOVING, 6000, 10 );
m_selectionTool->SanitizeSelection(); m_selectionTool->SanitizeSelection();
if( selection.Empty() ) if( selection.Empty() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment