[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19148] branches/blender2.5/blender: 2.5: Text Editor back.

Brecht Van Lommel brecht at blender.org
Sun Mar 1 00:33:43 CET 2009


Revision: 19148
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19148
Author:   blendix
Date:     2009-03-01 00:33:35 +0100 (Sun, 01 Mar 2009)

Log Message:
-----------
2.5: Text Editor back.

There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:

* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
  the text editor. It's Bitstream Vera Sans Mono. This is the
  default gnome terminal font, but it doesn't fit entirely well
  with the other font I think, can be changed easily of course.

* Clipboard copy/cut/paste now always uses the system clipboard,
  the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
  as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
  windowmanager code.

* Find panel is now a kind of second header, instead of a panel.
  This needs especially a way to start editing the text field
  immediately on open still.

* Operators are independent of the actual space when possible,
  was a bit of puzzling but got it solved nice with notifiers,
  and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.

* Operators:
    * New, Open, Reload, Save, Save As, Make Internal
    * Run Script, Refresh Pyconstraints
    * Copy, Cut, Paste
    * Convert Whitespace, Uncomment, Comment, Indent, Unindent
    * Line Break, Insert
    * Next Marker, Previous Marker, Clear All Markers, Mark All
    * Select Line, Select All
    * Jump, Move, Move Select, Delete, Toggle Overwrite
	* Scroll, Scroll Bar, Set Cursor, Line Number
    * Find and Replace, Find, Replace, Find Set Selected,
	  Replace Set Selected
    * To 3D Object
    * Resolve Conflict

Modified Paths:
--------------
    branches/blender2.5/blender/intern/ghost/GHOST_C-api.h
    branches/blender2.5/blender/intern/ghost/GHOST_ISystem.h
    branches/blender2.5/blender/intern/ghost/intern/GHOST_C-api.cpp
    branches/blender2.5/blender/intern/ghost/intern/GHOST_System.h
    branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
    branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.h
    branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
    branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.h
    branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemX11.cpp
    branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemX11.h
    branches/blender2.5/blender/source/blender/blenfont/BLF_api.h
    branches/blender2.5/blender/source/blender/blenfont/SConscript
    branches/blender2.5/blender/source/blender/blenkernel/BKE_context.h
    branches/blender2.5/blender/source/blender/blenkernel/BKE_text.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/context.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/curve.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/text.c
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/editors/curve/curve_intern.h
    branches/blender2.5/blender/source/blender/editors/curve/curve_ops.c
    branches/blender2.5/blender/source/blender/editors/curve/editfont.c
    branches/blender2.5/blender/source/blender/editors/include/ED_curve.h
    branches/blender2.5/blender/source/blender/editors/include/ED_datafiles.h
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
    branches/blender2.5/blender/source/blender/editors/space_image/image_header.c
    branches/blender2.5/blender/source/blender/editors/space_info/info_header.c
    branches/blender2.5/blender/source/blender/editors/space_text/Makefile
    branches/blender2.5/blender/source/blender/editors/space_text/SConscript
    branches/blender2.5/blender/source/blender/editors/space_text/space_text.c
    branches/blender2.5/blender/source/blender/editors/space_text/text_header.c
    branches/blender2.5/blender/source/blender/editors/space_text/text_intern.h
    branches/blender2.5/blender/source/blender/editors/util/undo.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_space_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_text_types.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c
    branches/blender2.5/blender/source/blender/windowmanager/WM_api.h
    branches/blender2.5/blender/source/blender/windowmanager/WM_types.h
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c

Added Paths:
-----------
    branches/blender2.5/blender/release/datafiles/bmonofont.ttf
    branches/blender2.5/blender/source/blender/editors/datafiles/bmonofont.ttf.c
    branches/blender2.5/blender/source/blender/editors/include/ED_text.h
    branches/blender2.5/blender/source/blender/editors/space_text/text_draw.c
    branches/blender2.5/blender/source/blender/editors/space_text/text_ops.c
    branches/blender2.5/blender/source/blender/editors/space_text/text_python.c

Modified: branches/blender2.5/blender/intern/ghost/GHOST_C-api.h
===================================================================
--- branches/blender2.5/blender/intern/ghost/GHOST_C-api.h	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/GHOST_C-api.h	2009-02-28 23:33:35 UTC (rev 19148)
@@ -771,14 +771,16 @@
 
 /**
  * Return the data from the clipboad
- * @return clipboard data
+ * @param	return the selection instead, X11 only feature
+ * @return	clipboard data
  */
-extern GHOST_TUns8* GHOST_getClipboard(int flag);
+extern GHOST_TUns8* GHOST_getClipboard(int selection);
 
 /**
  * Put data to the Clipboard
+ * @param	set the selection instead, X11 only feature
  */
-extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag);
+extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
 
 #ifdef __cplusplus
 }

Modified: branches/blender2.5/blender/intern/ghost/GHOST_ISystem.h
===================================================================
--- branches/blender2.5/blender/intern/ghost/GHOST_ISystem.h	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/GHOST_ISystem.h	2009-02-28 23:33:35 UTC (rev 19148)
@@ -356,12 +356,12 @@
 	 * @return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer
 	 *
 	 */
-	 virtual GHOST_TUns8* getClipboard(int flag) const = 0;
+	 virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
 
 	/**
 	 * Put data to the Clipboard
 	 */
-	virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0;
+	virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
 
 protected:
 	/**

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_C-api.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_C-api.cpp	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_C-api.cpp	2009-02-28 23:33:35 UTC (rev 19148)
@@ -810,15 +810,15 @@
 	return result;
 }
 
-GHOST_TUns8* GHOST_getClipboard(int flag)
+GHOST_TUns8* GHOST_getClipboard(int selection)
 {
 	GHOST_ISystem* system = GHOST_ISystem::getSystem();
-	return system->getClipboard(flag);
+	return system->getClipboard(selection);
 }
 
-void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag)
+void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
 {
 	GHOST_ISystem* system = GHOST_ISystem::getSystem();
-	system->putClipboard(buffer, flag);
+	system->putClipboard(buffer, selection);
 }
 

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_System.h
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_System.h	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_System.h	2009-02-28 23:33:35 UTC (rev 19148)
@@ -284,18 +284,18 @@
 
 	/**
 	 * Returns the selection buffer
-	 * @param flag		Only used on X11
-	 * @return 		Returns the clipboard data
+	 * @param selection		Only used on X11
+	 * @return 				Returns the clipboard data
 	 *
 	 */
-	 virtual GHOST_TUns8* getClipboard(int flag) const = 0;
+	 virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
 	  
 	  /**
 	   * Put data to the Clipboard
-	   * @param buffer	The buffer to copy to the clipboard
-	   * @param flag	The clipboard to copy too only used on X11
+	   * @param buffer		The buffer to copy to the clipboard
+	   * @param selection	The clipboard to copy too only used on X11
 	   */
-	  virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0;
+	  virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
 
 protected:
 	/**

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2009-02-28 23:33:35 UTC (rev 19148)
@@ -1119,7 +1119,7 @@
     return err;
 }
 
-GHOST_TUns8* GHOST_SystemCarbon::getClipboard(int flag) const
+GHOST_TUns8* GHOST_SystemCarbon::getClipboard(bool selection) const
 {
 	PasteboardRef inPasteboard;
 	PasteboardItemID itemID;
@@ -1158,9 +1158,9 @@
 	}
 }
 
-void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, int flag) const
+void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
 {
-	if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11
+	if(selection) {return;} // for copying the selection, used on X11
 
 	PasteboardRef inPasteboard;
 	CFDataRef textData = NULL;

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.h
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.h	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.h	2009-02-28 23:33:35 UTC (rev 19148)
@@ -169,10 +169,10 @@
 
 	/**
 	 * Returns Clipboard data
-	 * @param flag		Indicate which buffer to return
-	 * @return		Returns the selected buffer
+	 * @param selection		Indicate which buffer to return
+	 * @return				Returns the selected buffer
 	 */
-	virtual GHOST_TUns8* getClipboard(int flag) const;
+	virtual GHOST_TUns8* getClipboard(bool selection) const;
 	
 	/**
 	 * Puts buffer to system clipboard

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2009-02-28 23:33:35 UTC (rev 19148)
@@ -913,7 +913,7 @@
 	return lResult;
 }
 
-GHOST_TUns8* GHOST_SystemWin32::getClipboard(int flag) const 
+GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const 
 {
 	char *buffer;
 	char *temp_buff;
@@ -943,9 +943,10 @@
 	}
 }
 
-void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, int flag) const
+void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
 {
-	if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11
+	if(selection) {return;} // for copying the selection, used on X11
+
 	if (OpenClipboard(NULL)) {
 		HLOCAL clipbuffer;
 		char *data;

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.h
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.h	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.h	2009-02-28 23:33:35 UTC (rev 19148)
@@ -170,17 +170,17 @@
 
 	/**
 	 * Returns unsinged char from CUT_BUFFER0
-	 * @param flag		Flag is not used on win32 on used on X11
-	 * @return		Returns the Clipboard
+	 * @param selection		Used by X11 only
+	 * @return				Returns the Clipboard
 	 */
-	virtual GHOST_TUns8* getClipboard(int flag) const;
+	virtual GHOST_TUns8* getClipboard(bool selection) const;
 	
 	/**
 	 * Puts buffer to system clipboard
-	 * @param flag		Flag is not used on win32 on used on X11
-	 * @return		No return
+	 * @param selection		Used by X11 only
+	 * @return				No return
 	 */
-	virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+	virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
 	 
 protected:
 	/**

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2009-02-28 23:33:35 UTC (rev 19148)
@@ -1006,7 +1006,7 @@
 
 	GHOST_TUns8*
 GHOST_SystemX11::
-getClipboard(int flag
+getClipboard(bool selection
 ) const {
 	//Flag 
 	//0 = Regular clipboard 1 = selection
@@ -1027,7 +1027,7 @@
 	compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
 
 	//lets check the owner and if it is us then return the static buffer
-	if(flag == 0) {
+	if(!selection) {
 		Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
 		owner = XGetSelectionOwner(m_display, Primary_atom);
 		if (owner == m_window) {
@@ -1077,14 +1077,14 @@
 	void
 GHOST_SystemX11::
 putClipboard(
-GHOST_TInt8 *buffer, int flag) const
+GHOST_TInt8 *buffer, bool selection) const
 {
 	static Atom Primary_atom;
 	Window m_window, owner;
 	
 	if(!buffer) {return;}
 	
-	if(flag == 0) {
+	if(!selection) {
 		Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
 		if(txt_cut_buffer) { free((void*)txt_cut_buffer); }
 		

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemX11.h
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemX11.h	2009-02-28 22:25:23 UTC (rev 19147)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemX11.h	2009-02-28 23:33:35 UTC (rev 19148)
@@ -202,18 +202,17 @@
 		
 	/**
 	 * Returns unsinged char from CUT_BUFFER0
-	 * @param flag		Flag indicates which buffer to return 0 for clipboard 1 for selection
-	 * @return		Returns the Clipboard indicated by Flag
+	 * @param selection		Get selection, X11 only feature
+	 * @return				Returns the Clipboard indicated by Flag
 	 */
-		GHOST_TUns8*
-	getClipboard(int flag) const;
+	GHOST_TUns8* getClipboard(bool selection) const;
 	
 	/**
 	 * Puts buffer to system clipboard
 	 * @param buffer	The buffer to copy to the clipboard	
-	 * @param flag		Flag indicates which buffer to set ownership of 0 for clipboard 1 for selection
+	 * @param selection	Set the selection into the clipboard, X11 only feature
 	 */
-	virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+	virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
 
 	/**
 	 * Atom used for ICCCM, WM-spec and Motif.

Added: branches/blender2.5/blender/release/datafiles/bmonofont.ttf
===================================================================
(Binary files differ)


Property changes on: branches/blender2.5/blender/release/datafiles/bmonofont.ttf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list