You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(68) |
Aug
(4) |
Sep
|
Oct
(23) |
Nov
(95) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
(51) |
May
(81) |
Jun
(2) |
Jul
(86) |
Aug
(143) |
Sep
(3) |
Oct
(31) |
Nov
(63) |
Dec
(90) |
2005 |
Jan
(277) |
Feb
(157) |
Mar
(99) |
Apr
(195) |
May
(151) |
Jun
(148) |
Jul
(98) |
Aug
(123) |
Sep
(20) |
Oct
(174) |
Nov
(155) |
Dec
(26) |
2006 |
Jan
(51) |
Feb
(19) |
Mar
(16) |
Apr
(12) |
May
(5) |
Jun
|
Jul
(11) |
Aug
(7) |
Sep
(10) |
Oct
(31) |
Nov
(174) |
Dec
(56) |
2007 |
Jan
(45) |
Feb
(52) |
Mar
(10) |
Apr
(5) |
May
(47) |
Jun
(16) |
Jul
(80) |
Aug
(29) |
Sep
(14) |
Oct
(59) |
Nov
(46) |
Dec
(16) |
2008 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
(49) |
Jun
(26) |
Jul
(8) |
Aug
(4) |
Sep
(25) |
Oct
(53) |
Nov
(9) |
Dec
(1) |
2009 |
Jan
(66) |
Feb
(11) |
Mar
(1) |
Apr
(14) |
May
(8) |
Jun
(1) |
Jul
(2) |
Aug
(2) |
Sep
(9) |
Oct
(23) |
Nov
(35) |
Dec
|
2010 |
Jan
(7) |
Feb
(2) |
Mar
(39) |
Apr
(19) |
May
(161) |
Jun
(19) |
Jul
(32) |
Aug
(65) |
Sep
(113) |
Oct
(120) |
Nov
(2) |
Dec
|
2012 |
Jan
|
Feb
(5) |
Mar
(4) |
Apr
(7) |
May
(9) |
Jun
(14) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(12) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
(17) |
Mar
(4) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(8) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Axel S. <A....@ke...> - 2007-12-02 21:38:34
|
Sun Dec 2 13:19:58 PST 2007 A....@ke... * Complete the default drag and drop interface for ListStore. This patch completes the former patch which adds the C functions to the C custom model. With this patch it is possible to reorder the rows of a list store using drag and drop. The drag and drop for tree stores doesn't quite work yet since I'm not sure what the exact semantics are (do we move a row at a time, or a full tree? is the last index of the drop path the position where we insert the new row?). This patch also enables the reordering in the two listtest and treetest demo programs. hunk ./Makefile.am 559 + gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs \ hunk ./demo/treeList/ListTest.hs 67 + New.treeViewSetReorderable view True + hunk ./demo/treeList/TreeTest.hs 64 + + New.treeViewSetReorderable view True hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs 32 + DragAction(..), hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs 67 +-- | Specify the kind of action performed on a drag event. +{#enum DragAction {underscoreToCase} deriving (Bounded)#} + +instance Flags DragAction + hunk ./gtk/Graphics/UI/Gtk/Gdk/Events.hsc 79 + | ButtonLeft + | ButtonRight + | ButtonMiddle hunk ./gtk/Graphics/UI/Gtk/Gdk/Events.hsc 90 + toEnum #{const GDK_BUTTON1_MASK} = ButtonLeft + toEnum #{const GDK_BUTTON2_MASK} = ButtonRight + toEnum #{const GDK_BUTTON3_MASK} = ButtonMiddle hunk ./gtk/Graphics/UI/Gtk/Gdk/Events.hsc 98 + fromEnum ButtonLeft = #{const GDK_BUTTON1_MASK} + fromEnum ButtonRight = #{const GDK_BUTTON2_MASK} + fromEnum ButtonMiddle = #{const GDK_BUTTON3_MASK} hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 62 + DragAction(..), + DestDefaults(..), + DragProtocol(..), hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 258 --- | Returns the list of targets this widget can accept from drag-and-drop. +-- | Returns the list of targets this widget can accept for drag-and-drop. hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 39 - [_$_] + TargetFlags(..), + [_$_] hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 94 -import Graphics.UI.Gtk.General.Enums (TargetFlags) +import Graphics.UI.Gtk.General.Enums (TargetFlags(..)) hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 153 --- flag is @True@ then serializable rich text formats will be added, +-- flag is @True@ then deserializable rich text formats will be added, hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 29 - [_$_] + hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 39 + DragSourceIface(..), + DragDestIface(..), hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 83 -instance GObjectClass (CustomTreeModel private row) + hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 129 -data CustomTreeModelImplementation row = CustomTreeModelImplementation { - customTreeModelColumns :: ColumnMap row, -- provide access via columns +data CustomTreeModelImplementation model row = CustomTreeModelImplementation { + customTreeModelColumns :: ColumnMap row, -- provide access via columns hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 132 - customTreeDragSourceIface :: DragSourceIface, -- the drag and drop source interface - customTreeDragDestIface :: DragDestIface -- the drag and drop dest interface + customTreeDragSourceIface :: DragSourceIface model row, -- the drag and drop source interface + customTreeDragDestIface :: DragDestIface model row -- the drag and drop dest interface hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 151 -data DragSourceIface = DragSourceIface { - treeDragSourceRowDraggable :: TreePath -> IO Bool, -- query if the row is draggable - treeDragSourceDragDataGet :: TreePath -> SelectionDataM Bool, -- store row in selection object - treeDragSourceDragDataDelete:: TreePath -> IO Bool -- instruct store to delete the row +data DragSourceIface model row = DragSourceIface { + treeDragSourceRowDraggable :: model row -> TreePath -> IO Bool, -- query if the row is draggable + treeDragSourceDragDataGet :: model row -> TreePath -> SelectionDataM Bool, -- store row in selection object + treeDragSourceDragDataDelete:: model row -> TreePath -> IO Bool -- instruct store to delete the row hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 157 -data DragDestIface = DragDestIface { - treeDragDestDragDataReceived:: TreePath -> SelectionDataM Bool, -- insert row from selection object - treeDragDestRowDropPossible :: TreePath -> SelectionDataM Bool -- query if row drop is possible +data DragDestIface model row = DragDestIface { + treeDragDestRowDropPossible :: model row -> TreePath -> SelectionDataM Bool, -- query if row drop is possible + treeDragDestDragDataReceived:: model row -> TreePath -> SelectionDataM Bool -- insert row from selection object hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 163 --- optionally the 'DragSourceIface' and the 'DragDestIface'. If the latter to +-- optionally the 'DragSourceIface' and the 'DragDestIface'. If the latter two hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 165 --- drag and drops. -customTreeModelNew :: private -- | Any private data the store needs to store. Usually an 'IORef'. - -> TreeModelIface row -- | Functions necessary to implement the 'TreeModel' interface. - -> Maybe DragSourceIface -- | Functions to enable this store to generate drag events. - -> Maybe DragDestIface -- | Functions to enable this store to receive drag events. - -> IO (CustomTreeModel private row) -customTreeModelNew priv tmIface mDragSource mDragDest = do +-- drag and drop. +customTreeModelNew :: (TreeModelClass (model row), TypedTreeModelClass model) => + private -- ^ Any private data the store needs to store. Usually an 'IORef'. + -> ((CustomTreeModel private row) -> model row) + -> TreeModelIface row -- ^ Functions necessary to implement the 'TreeModel' interface. + -> Maybe (DragSourceIface model row) + -- ^ Functions to enable this store to generate drag events. + -> Maybe (DragDestIface model row) + -- ^ Functions to enable this store to receive drag events. + -> IO (model row) +customTreeModelNew priv con tmIface mDragSource mDragDest = do hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 177 - let dummyDragSource = DragSourceIface { treeDragSourceRowDraggable = \_ -> return False, - treeDragSourceDragDataGet = \_ -> return False, - treeDragSourceDragDataDelete = \_ -> return False } - let dummyDragDest = DragDestIface { treeDragDestDragDataReceived = \_ -> return False, - treeDragDestRowDropPossible = \_ -> return False } - implPtr <- newStablePtr CustomTreeModelImplementation { customTreeModelColumns = cMap, - customTreeModelIface = tmIface, - customTreeDragSourceIface = fromMaybe dummyDragSource mDragSource, - customTreeDragDestIface = fromMaybe dummyDragDest mDragDest } + let dummyDragSource = DragSourceIface { treeDragSourceRowDraggable = \_ _ -> return False, + treeDragSourceDragDataGet = \_ _ -> return False, + treeDragSourceDragDataDelete = \_ _ -> return False } + let dummyDragDest = DragDestIface { treeDragDestRowDropPossible = \_ _ -> return False, + treeDragDestDragDataReceived = \_ _ -> return False } + implPtr <- newStablePtr CustomTreeModelImplementation { + customTreeModelColumns = cMap, + customTreeModelIface = tmIface, + customTreeDragSourceIface = fromMaybe dummyDragSource mDragSource, + customTreeDragDestIface = fromMaybe dummyDragDest mDragDest } hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 188 - makeNewGObject CustomTreeModel $ + liftM con $ makeNewGObject CustomTreeModel $ hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 192 - gtk2hs_store_new :: StablePtr (CustomTreeModelImplementation row) + gtk2hs_store_new :: StablePtr (CustomTreeModelImplementation model row) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 204 - gtk2hs_store_get_impl :: Ptr (TypedTreeModel row) -> IO (StablePtr (CustomTreeModelImplementation row)) + gtk2hs_store_get_impl :: Ptr (TypedTreeModel row) -> IO (StablePtr (CustomTreeModelImplementation model row)) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 229 -treeModelIfaceGetNColumns_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt +treeModelIfaceGetNColumns_static :: StablePtr (CustomTreeModelImplementation model row) -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 236 - treeModelIfaceGetNColumns_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt + treeModelIfaceGetNColumns_static :: StablePtr (CustomTreeModelImplementation model row) -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 245 -treeModelIfaceGetColumnType_static :: StablePtr (CustomTreeModelImplementation row) -> CInt -> IO GType +treeModelIfaceGetColumnType_static :: StablePtr (CustomTreeModelImplementation model row) -> CInt -> IO GType hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 254 - treeModelIfaceGetColumnType_static :: StablePtr (CustomTreeModelImplementation row) -> CInt -> IO GType + treeModelIfaceGetColumnType_static :: StablePtr (CustomTreeModelImplementation model row) -> CInt -> IO GType hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 257 -treeModelIfaceGetFlags_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt +treeModelIfaceGetFlags_static :: StablePtr (CustomTreeModelImplementation model row) -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 263 - treeModelIfaceGetFlags_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt + treeModelIfaceGetFlags_static :: StablePtr (CustomTreeModelImplementation model row) -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 266 -treeModelIfaceGetIter_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr NativeTreePath -> IO CInt +treeModelIfaceGetIter_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> Ptr NativeTreePath -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 277 - treeModelIfaceGetIter_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr NativeTreePath -> IO CInt + treeModelIfaceGetIter_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> Ptr NativeTreePath -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 279 -treeModelIfaceGetPath_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO (Ptr NativeTreePath) +treeModelIfaceGetPath_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO (Ptr NativeTreePath) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 288 - treeModelIfaceGetPath_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO (Ptr NativeTreePath) + treeModelIfaceGetPath_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO (Ptr NativeTreePath) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 291 -treeModelIfaceGetValue_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () +treeModelIfaceGetValue_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 309 - treeModelIfaceGetValue_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () + treeModelIfaceGetValue_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 312 -treeModelIfaceIterNext_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt +treeModelIfaceIterNext_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 323 - treeModelIfaceIterNext_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt + treeModelIfaceIterNext_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 326 -treeModelIfaceIterChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt +treeModelIfaceIterChildren_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 337 - treeModelIfaceIterChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt + treeModelIfaceIterChildren_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 340 -treeModelIfaceIterHasChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt +treeModelIfaceIterHasChild_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 347 - treeModelIfaceIterHasChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt + treeModelIfaceIterHasChild_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 350 -treeModelIfaceIterNChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt +treeModelIfaceIterNChildren_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 357 - treeModelIfaceIterNChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt + treeModelIfaceIterNChildren_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 360 -treeModelIfaceIterNthChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> CInt -> IO CInt +treeModelIfaceIterNthChild_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> Ptr TreeIter -> CInt -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 371 - treeModelIfaceIterNthChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> CInt -> IO CInt + treeModelIfaceIterNthChild_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> Ptr TreeIter -> CInt -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 374 -treeModelIfaceIterParent_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt +treeModelIfaceIterParent_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 385 - treeModelIfaceIterParent_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt + treeModelIfaceIterParent_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 388 -treeModelIfaceRefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () +treeModelIfaceRefNode_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 395 - treeModelIfaceRefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () + treeModelIfaceRefNode_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 398 -treeModelIfaceUnrefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () +treeModelIfaceUnrefNode_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 405 - treeModelIfaceUnrefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () + treeModelIfaceUnrefNode_static :: StablePtr (CustomTreeModelImplementation model row) -> Ptr TreeIter -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 407 -treeDragSourceRowDraggable_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> IO CInt -treeDragSourceRowDraggable_static storePtr pathPtr = do +treeDragSourceRowDraggable_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> IO CInt +treeDragSourceRowDraggable_static mPtr storePtr pathPtr = do + model <- makeNewGObject mkTreeModel (return mPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 412 - liftM fromBool $ treeDragSourceRowDraggable store path + liftM fromBool $ treeDragSourceRowDraggable store (unsafeTreeModelToGeneric model) path hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 415 - treeDragSourceRowDraggable_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> IO CInt + treeDragSourceRowDraggable_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 417 -treeDragSourceDragDataGet_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt -treeDragSourceDragDataGet_static storePtr pathPtr selectionPtr = do +treeDragSourceDragDataGet_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> SelectionData -> IO CInt +treeDragSourceDragDataGet_static mPtr storePtr pathPtr selectionPtr = do + model <- makeNewGObject mkTreeModel (return mPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 422 - liftM fromBool $ runReaderT (treeDragSourceDragDataGet store path) selectionPtr + liftM fromBool $ runReaderT (treeDragSourceDragDataGet store (unsafeTreeModelToGeneric model) path) selectionPtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 425 - treeDragSourceDragDataGet_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt + treeDragSourceDragDataGet_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> SelectionData -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 427 -treeDragSourceDragDataDelete_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> IO CInt -treeDragSourceDragDataDelete_static storePtr pathPtr = do +treeDragSourceDragDataDelete_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> IO CInt +treeDragSourceDragDataDelete_static mPtr storePtr pathPtr = do + model <- makeNewGObject mkTreeModel (return mPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 432 - liftM fromBool $ treeDragSourceDragDataDelete store path + liftM fromBool $ treeDragSourceDragDataDelete store (unsafeTreeModelToGeneric model) path hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 435 - treeDragSourceDragDataDelete_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> IO CInt + treeDragSourceDragDataDelete_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 437 -treeDragDestDragDataReceived_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt -treeDragDestDragDataReceived_static storePtr pathPtr selectionPtr = do +treeDragDestDragDataReceived_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> SelectionData -> IO CInt +treeDragDestDragDataReceived_static mPtr storePtr pathPtr selectionPtr = do + model <- makeNewGObject mkTreeModel (return mPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 442 - liftM fromBool $ runReaderT (treeDragDestDragDataReceived store path) selectionPtr + liftM fromBool $ runReaderT (treeDragDestDragDataReceived store (unsafeTreeModelToGeneric model) path) selectionPtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 445 - treeDragDestDragDataReceived_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt + treeDragDestDragDataReceived_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> SelectionData -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 447 -treeDragDestRowDropPossible_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt -treeDragDestRowDropPossible_static storePtr pathPtr selectionPtr = do +treeDragDestRowDropPossible_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> SelectionData -> IO CInt +treeDragDestRowDropPossible_static mPtr storePtr pathPtr selectionPtr = do + model <- makeNewGObject mkTreeModel (return mPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 452 - liftM fromBool $ runReaderT (treeDragDestRowDropPossible store path) selectionPtr + liftM fromBool $ runReaderT (treeDragDestRowDropPossible store (unsafeTreeModelToGeneric model) path) selectionPtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 455 - treeDragDestRowDropPossible_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt + treeDragDestRowDropPossible_static :: Ptr TreeModel -> StablePtr (CustomTreeModelImplementation model row) -> Ptr NativeTreePath -> SelectionData -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 637 - gboolean result = gtk2hs_store_row_draggable_impl(store->impl, path); + gboolean result = gtk2hs_store_row_draggable_impl(drag_source, store->impl, path); hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 655 - gboolean result = gtk2hs_store_drag_data_get_impl(store->impl, path, selection_data); + gboolean result = gtk2hs_store_drag_data_get_impl(drag_source, store->impl, path, selection_data); hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 671 - gboolean result = gtk2hs_store_drag_data_delete_impl(store->impl, path); + gboolean result = gtk2hs_store_drag_data_delete_impl(drag_source, store->impl, path); hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 689 - gboolean result = gtk2hs_store_drag_data_received_impl(store->impl, dest_path, selection_data); + gboolean result = gtk2hs_store_drag_data_received_impl(drag_dest, store->impl, dest_path, selection_data); hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 707 - gboolean result = gtk2hs_store_row_drop_possible_impl(store->impl, dest_path, selection_data); + gboolean result = gtk2hs_store_row_drop_possible_impl(drag_dest, store->impl, dest_path, selection_data); hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 35 +-- * Implementation of Interfaces + listStoreDefaultDragSourceIface, + listStoreDefaultDragDestIface, + [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 67 +import Graphics.UI.Gtk.ModelView.TreeDrag +import Control.Monad.Trans ( liftIO ) hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 78 +-- | Create a new 'TreeModel' that contains a list of elements. hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 80 -listStoreNew xs = do +listStoreNew xs = listStoreNewDND xs (Just listStoreDefaultDragSourceIface) + (Just listStoreDefaultDragDestIface) + +-- | Create a new 'TreeModel' that contains a list of elements. In addition, specify two +-- interfaces for drag and drop. +-- +listStoreNewDND :: [a] -- ^ the initial content of the model + -> Maybe (DragSourceIface ListStore a) -- ^ an optional interface for drags + -> Maybe (DragDestIface ListStore a) -- ^ an optional interface to handle drops + -> IO (ListStore a) -- ^ the new model +listStoreNewDND xs mDSource mDDest = do hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 93 - liftM ListStore $ customTreeModelNew rows TreeModelIface { + customTreeModelNew rows ListStore TreeModelIface { hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 122 - } Nothing Nothing + } mDSource mDDest + + +-- | Default drag functions for 'Graphics.UI.Gtk.ModelView.ListStore'. These +-- functions allow the rows of the model to serve as drag source. Any row is +-- allowed to be dragged and the data set in the 'SelectionDataM' object is +-- set with 'treeSetRowDragData', i.e. it contains the model and the +-- 'TreePath' to the row. +listStoreDefaultDragSourceIface :: DragSourceIface ListStore row +listStoreDefaultDragSourceIface = DragSourceIface { + treeDragSourceRowDraggable = \_ _-> return True, + treeDragSourceDragDataGet = treeSetRowDragData, + treeDragSourceDragDataDelete = \model (dest:_) -> do + liftIO $ listStoreRemove model dest + return True + + } + +-- | Default drop functions for 'Graphics.UI.Gtk.ModelView.ListStore'. These +-- functions accept a row and insert the row into the new location if it is +-- dragged into a tree view +-- that uses the same model. +listStoreDefaultDragDestIface :: DragDestIface ListStore row +listStoreDefaultDragDestIface = DragDestIface { + treeDragDestRowDropPossible = \model dest -> do + mModelPath <- treeGetRowDragData + case mModelPath of + Nothing -> return False + Just (model', source) -> return (treeModelEqual model model'), + treeDragDestDragDataReceived = \model (dest:_) -> do + mModelPath <- treeGetRowDragData + case mModelPath of + Nothing -> return False + Just (model', (source:_)) -> + if not (treeModelEqual model model') then return False + else liftIO $ do + row <- listStoreGetValue model source + listStoreInsert model dest row + return True + } hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 287 + hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 87 - TreeModelFlags(..), hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 35 +-- * Implementation of Interfaces + treeStoreDefaultDragSourceIface, + treeStoreDefaultDragDestIface, + hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 64 +import Graphics.UI.Gtk.ModelView.TreeDrag +import Control.Monad.Trans ( liftIO ) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 100 -treeStoreNew forest = do +treeStoreNew forest = treeStoreNewDND forest + (Just treeStoreDefaultDragSourceIface) + (Just treeStoreDefaultDragDestIface) + +-- | Create a new list store. +-- +-- * In addition to 'treeStoreNew', this function takes an two interfaces +-- to implement user-defined drag-and-drop functionality. +-- +treeStoreNewDND :: Forest a -- ^ the inital tree stored in this model + -> Maybe (DragSourceIface TreeStore a) -- ^ an optional interface for drags + -> Maybe (DragDestIface TreeStore a) -- ^ an optional interface to handle drops + -> IO (TreeStore a) +treeStoreNewDND forest mDSource mDDest = do hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 125 - liftM TreeStore $ customTreeModelNew storeRef TreeModelIface { + customTreeModelNew storeRef TreeStore TreeModelIface { hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 169 - } Nothing Nothing + } mDSource mDDest + + +-- | Default drag functions for +-- 'Graphics.UI.Gtk.ModelView.TreeStore'. These functions allow the rows of +-- the model to serve as drag source. Any row is allowed to be dragged and the +-- data set in the 'SelectionDataM' object is set with 'treeSetRowDragData', +-- i.e. it contains the model and the 'TreePath' to the row. +treeStoreDefaultDragSourceIface :: DragSourceIface TreeStore row +treeStoreDefaultDragSourceIface = DragSourceIface { + treeDragSourceRowDraggable = \_ _-> return True, + treeDragSourceDragDataGet = treeSetRowDragData, + treeDragSourceDragDataDelete = \model dest@(_:_) -> do + liftIO $ treeStoreRemove model dest + return True + + } + +-- | Default drop functions for 'Graphics.UI.Gtk.ModelView.TreeStore'. These +-- functions accept a row and insert the row into the new location if it is +-- dragged into a tree view +-- that uses the same model. +treeStoreDefaultDragDestIface :: DragDestIface TreeStore row +treeStoreDefaultDragDestIface = DragDestIface { + treeDragDestRowDropPossible = \model dest -> do + mModelPath <- treeGetRowDragData + case mModelPath of + Nothing -> return False + Just (model', source) -> return (treeModelEqual model model'), + treeDragDestDragDataReceived = \model dest@(_:_) -> do + mModelPath <- treeGetRowDragData + case mModelPath of + Nothing -> return False + Just (model', source@(_:_)) -> + if not (treeModelEqual model model') then return False + else liftIO $ do + row <- treeStoreGetTree model source + treeStoreInsertTree model (init dest) (last dest) row + return True + } hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 83 + DragAction(..), + TreeViewGridLines(..), hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 107 - treeViewInsertColumnWithAttributes, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 152 +#if GTK_CHECK_VERSION(2,10,0) + treeViewGetHeadersClickable, +#endif +#endif +#if GTK_CHECK_VERSION(2,8,0) + treeViewGetVisibleRange, +#endif + treeViewEnableModelDragDest, + treeViewEnableModelDragSource, +#if GTK_CHECK_VERSION(2,10,0) + treeViewGetSearchEntry, + treeViewSetSearchEntry, +#endif +#if GTK_CHECK_VERSION(2,6,0) + treeViewSetRowSeparatorFunc, +#if GTK_CHECK_VERSION(2,10,0) + treeViewGetRubberBanding, + treeViewSetRubberBanding, + treeViewGetEnableTreeLines, + treeViewSetEnableTreeLines, + treeViewGetGridLines, + treeViewSetGridLines, +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 218 +import System.Glib.Flags hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 223 +import Graphics.UI.Gtk.Gdk.Enums (DragAction(..)) +import Graphics.UI.Gtk.Gdk.Events (Modifier(..))[_^I_][_^I_][_^I_][_^I_][_^I_] [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 229 -{#import Graphics.UI.Gtk.TreeList.TreePath#} -{#import Graphics.UI.Gtk.TreeList.TreeIter#} hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 230 +{#import Graphics.UI.Gtk.ModelView.Types#} +{#import Graphics.UI.Gtk.General.DNDTypes#} (TargetList(..)) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 414 --- | Insert new 'TreeViewColumn'. --- --- * Inserts new column into the --- 'TreeView' @self@ at position @pos@ with title --- ref argtitle, cell renderer @cr@ and attributes --- @attribs@. Specify -1 for @pos@ to insert the column at --- the end. --- -treeViewInsertColumnWithAttributes :: (TreeViewClass self, CellRendererClass cr) - => self -> Int -> String -> cr -> [(String,Int)] -> IO () -treeViewInsertColumnWithAttributes self pos title cr attribs = do - column <- treeViewColumnNew - treeViewColumnSetTitle column title - treeViewColumnPackStart column cr True - treeViewColumnAddAttributes column cr attribs - treeViewInsertColumn self column pos - return () - hunk ./gtk/Graphics/UI/Gtk/ModelView/Types.chs 33 + unsafeTreeModelToGeneric, hunk ./gtk/Graphics/UI/Gtk/ModelView/Types.chs 53 -{#import Graphics.UI.Gtk.Types#} () +{#import Graphics.UI.Gtk.Types#} (TreeModel) hunk ./gtk/Graphics/UI/Gtk/ModelView/Types.chs 69 +unsafeTreeModelToGeneric :: TreeModel -> model row +unsafeTreeModelToGeneric = unsafeCoerce# + |
From: Axel S. <A....@ke...> - 2007-12-02 21:38:34
|
Fri Jul 20 05:34:34 PDT 2007 A....@ke... * Add drag and drop interfaces to the CustomStore. Both, ListStore and TreeStore should implement the drag and drop interfaces because the Gtk ListStore and TreeStore do. However, I'm not sure yet what they exactly implement; I assume they only accept rows from the same store. Figure out how to implement this in Haskell and provide a way to add the possiblity of accepting other dnd sources and destinations as well. hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 33 - columnMapNew, hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 38 - CustomTreeModelImplementation(..), + TreeModelIface(..), hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 44 -import Control.Monad (liftM, when) -import Data.IORef +import Control.Monad (liftM, when) +import Control.Monad.Reader (runReaderT) +import Data.IORef (IORef, newIORef, readIORef, writeIORef) +import Data.Maybe (fromMaybe) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 53 -import System.Glib.StoreValue (TMType(..), GenericValue(..) - ,valueSetGenericValue) +import Graphics.UI.Gtk.General.DNDTypes (SelectionDataM, SelectionData) + +import System.Glib.StoreValue (TMType(..), GenericValue(..), valueSetGenericValue) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 77 --- A CustomTreeModel is backed by a Gtk2HsStore +-- | A CustomTreeModel is backed by a Gtk2HsStore merger 0.0 ( hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 81 -instance GObjectClass (CustomTreeModel private row) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 81 +-- this is currently a receipe for segfaults: ) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 128 - customTreeModelGetFlags :: IO [TreeModelFlags], - customTreeModelColumns :: ColumnMap row, -- provide access via columns - customTreeModelGetIter :: TreePath -> IO (Maybe TreeIter), -- convert a path to an iterator - customTreeModelGetPath :: TreeIter -> IO TreePath, -- convert an interator to a path - customTreeModelGetRow :: TreeIter -> IO row, -- get the row at an iter - customTreeModelIterNext :: TreeIter -> IO (Maybe TreeIter), -- following row (if any) - customTreeModelIterChildren :: Maybe TreeIter -> IO (Maybe TreeIter), -- first child row (if any) - customTreeModelIterHasChild :: TreeIter -> IO Bool, -- row has any children at all - customTreeModelIterNChildren :: Maybe TreeIter -> IO Int, -- number of children of a row - customTreeModelIterNthChild :: Maybe TreeIter -> Int -> IO (Maybe TreeIter), -- nth child row of a given row - customTreeModelIterParent :: TreeIter -> IO (Maybe TreeIter), -- parent row of a row - customTreeModelRefNode :: TreeIter -> IO (), -- caching hint - customTreeModelUnrefNode :: TreeIter -> IO () -- caching hint + customTreeModelColumns :: ColumnMap row, -- provide access via columns + customTreeModelIface :: TreeModelIface row, -- functions implementing a tree model + customTreeDragSourceIface :: DragSourceIface, -- the drag and drop source interface + customTreeDragDestIface :: DragDestIface -- the drag and drop dest interface + } + +data TreeModelIface row = TreeModelIface { + treeModelIfaceGetFlags :: IO [TreeModelFlags], + treeModelIfaceGetIter :: TreePath -> IO (Maybe TreeIter), -- convert a path to an iterator + treeModelIfaceGetPath :: TreeIter -> IO TreePath, -- convert an interator to a path + treeModelIfaceGetRow :: TreeIter -> IO row, -- get the row at an iter + treeModelIfaceIterNext :: TreeIter -> IO (Maybe TreeIter), -- following row (if any) + treeModelIfaceIterChildren :: Maybe TreeIter -> IO (Maybe TreeIter), -- first child row (if any) + treeModelIfaceIterHasChild :: TreeIter -> IO Bool, -- row has any children at all + treeModelIfaceIterNChildren :: Maybe TreeIter -> IO Int, -- number of children of a row + treeModelIfaceIterNthChild :: Maybe TreeIter -> Int -> IO (Maybe TreeIter), -- nth child row of a given row + treeModelIfaceIterParent :: TreeIter -> IO (Maybe TreeIter), -- parent row of a row + treeModelIfaceRefNode :: TreeIter -> IO (), -- caching hint + treeModelIfaceUnrefNode :: TreeIter -> IO () -- caching hint hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 149 -customTreeModelNew :: private -> CustomTreeModelImplementation row -> IO (CustomTreeModel private row) -customTreeModelNew priv impl = do - implPtr <- newStablePtr impl +data DragSourceIface = DragSourceIface { + treeDragSourceRowDraggable :: TreePath -> IO Bool, -- query if the row is draggable + treeDragSourceDragDataGet :: TreePath -> SelectionDataM Bool, -- store row in selection object + treeDragSourceDragDataDelete:: TreePath -> IO Bool -- instruct store to delete the row + } + +data DragDestIface = DragDestIface { + treeDragDestDragDataReceived:: TreePath -> SelectionDataM Bool, -- insert row from selection object + treeDragDestRowDropPossible :: TreePath -> SelectionDataM Bool -- query if row drop is possible + } + [_$_] +-- | Create a new store that implements the 'TreeModelIface' interface and +-- optionally the 'DragSourceIface' and the 'DragDestIface'. If the latter to +-- are set to @Nothing@ a dummy interface is substituted that rejects every +-- drag and drops. +customTreeModelNew :: private -- | Any private data the store needs to store. Usually an 'IORef'. + -> TreeModelIface row -- | Functions necessary to implement the 'TreeModel' interface. + -> Maybe DragSourceIface -- | Functions to enable this store to generate drag events. + -> Maybe DragDestIface -- | Functions to enable this store to receive drag events. + -> IO (CustomTreeModel private row) +customTreeModelNew priv tmIface mDragSource mDragDest = do + cMap <- columnMapNew + let dummyDragSource = DragSourceIface { treeDragSourceRowDraggable = \_ -> return False, + treeDragSourceDragDataGet = \_ -> return False, + treeDragSourceDragDataDelete = \_ -> return False } + let dummyDragDest = DragDestIface { treeDragDestDragDataReceived = \_ -> return False, + treeDragDestRowDropPossible = \_ -> return False } + implPtr <- newStablePtr CustomTreeModelImplementation { customTreeModelColumns = cMap, + customTreeModelIface = tmIface, + customTreeDragSourceIface = fromMaybe dummyDragSource mDragSource, + customTreeDragDestIface = fromMaybe dummyDragDest mDragDest } hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 194 - customTreeModelGetRow impl iter + treeModelIfaceGetRow (customTreeModelIface impl) iter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 222 - -customTreeModelGetFlags_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt -customTreeModelGetFlags_static storePtr = do - store <- deRefStablePtr storePtr - liftM (fromIntegral . fromFlags) $ customTreeModelGetFlags store - -foreign export ccall "gtk2hs_store_get_flags_impl" - customTreeModelGetFlags_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt - - -customTreeModelGetNColumns_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt -customTreeModelGetNColumns_static storePtr = do +treeModelIfaceGetNColumns_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt +treeModelIfaceGetNColumns_static storePtr = do hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 229 - customTreeModelGetNColumns_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt + treeModelIfaceGetNColumns_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 238 -customTreeModelGetColumnType_static :: StablePtr (CustomTreeModelImplementation row) -> CInt -> IO GType -customTreeModelGetColumnType_static storePtr column = do +treeModelIfaceGetColumnType_static :: StablePtr (CustomTreeModelImplementation row) -> CInt -> IO GType +treeModelIfaceGetColumnType_static storePtr column = do hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 247 - customTreeModelGetColumnType_static :: StablePtr (CustomTreeModelImplementation row) -> CInt -> IO GType + treeModelIfaceGetColumnType_static :: StablePtr (CustomTreeModelImplementation row) -> CInt -> IO GType hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 250 -customTreeModelGetIter_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr NativeTreePath -> IO CInt -customTreeModelGetIter_static storePtr iterPtr pathPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceGetFlags_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt +treeModelIfaceGetFlags_static storePtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr + liftM (fromIntegral . fromFlags) $ treeModelIfaceGetFlags store + +foreign export ccall "gtk2hs_store_get_flags_impl" + treeModelIfaceGetFlags_static :: StablePtr (CustomTreeModelImplementation row) -> IO CInt + + +treeModelIfaceGetIter_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr NativeTreePath -> IO CInt +treeModelIfaceGetIter_static storePtr iterPtr pathPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 263 - iter <- customTreeModelGetIter store path + iter <- treeModelIfaceGetIter store path hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 270 - customTreeModelGetIter_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr NativeTreePath -> IO CInt + treeModelIfaceGetIter_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr NativeTreePath -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 272 -customTreeModelGetPath_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO (Ptr NativeTreePath) -customTreeModelGetPath_static storePtr iterPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceGetPath_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO (Ptr NativeTreePath) +treeModelIfaceGetPath_static storePtr iterPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 276 - path <- customTreeModelGetPath store iter + path <- treeModelIfaceGetPath store iter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 281 - customTreeModelGetPath_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO (Ptr NativeTreePath) + treeModelIfaceGetPath_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO (Ptr NativeTreePath) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 284 -customTreeModelGetValue_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () -customTreeModelGetValue_static storePtr iterPtr column gvaluePtr = do +treeModelIfaceGetValue_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () +treeModelIfaceGetValue_static storePtr iterPtr column gvaluePtr = do hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 288 - row <- customTreeModelGetRow store iter + row <- treeModelIfaceGetRow (customTreeModelIface store) iter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 302 - customTreeModelGetValue_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () + treeModelIfaceGetValue_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 305 -customTreeModelIterNext_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt -customTreeModelIterNext_static storePtr iterPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceIterNext_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt +treeModelIfaceIterNext_static storePtr iterPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 309 - iter' <- customTreeModelIterNext store iter + iter' <- treeModelIfaceIterNext store iter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 316 - customTreeModelIterNext_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt + treeModelIfaceIterNext_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 319 -customTreeModelIterChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt -customTreeModelIterChildren_static storePtr iterPtr parentIterPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceIterChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt +treeModelIfaceIterChildren_static storePtr iterPtr parentIterPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 323 - iter <- customTreeModelIterChildren store parentIter + iter <- treeModelIfaceIterChildren store parentIter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 330 - customTreeModelIterChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt + treeModelIfaceIterChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 333 -customTreeModelIterHasChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt -customTreeModelIterHasChild_static storePtr iterPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceIterHasChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt +treeModelIfaceIterHasChild_static storePtr iterPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 337 - liftM fromBool $ customTreeModelIterHasChild store iter + liftM fromBool $ treeModelIfaceIterHasChild store iter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 340 - customTreeModelIterHasChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt + treeModelIfaceIterHasChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 343 -customTreeModelIterNChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt -customTreeModelIterNChildren_static storePtr iterPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceIterNChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt +treeModelIfaceIterNChildren_static storePtr iterPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 347 - liftM fromIntegral $ customTreeModelIterNChildren store iter + liftM fromIntegral $ treeModelIfaceIterNChildren store iter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 350 - customTreeModelIterNChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt + treeModelIfaceIterNChildren_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 353 -customTreeModelIterNthChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> CInt -> IO CInt -customTreeModelIterNthChild_static storePtr iterPtr parentIterPtr n = do - store <- deRefStablePtr storePtr +treeModelIfaceIterNthChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> CInt -> IO CInt +treeModelIfaceIterNthChild_static storePtr iterPtr parentIterPtr n = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 357 - iter <- customTreeModelIterNthChild store parentIter (fromIntegral n) + iter <- treeModelIfaceIterNthChild store parentIter (fromIntegral n) hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 364 - customTreeModelIterNthChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> CInt -> IO CInt + treeModelIfaceIterNthChild_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> CInt -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 367 -customTreeModelIterParent_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt -customTreeModelIterParent_static storePtr iterPtr childIterPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceIterParent_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt +treeModelIfaceIterParent_static storePtr iterPtr childIterPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 371 - iter <- customTreeModelIterParent store childIter + iter <- treeModelIfaceIterParent store childIter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 378 - customTreeModelIterParent_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt + treeModelIfaceIterParent_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> Ptr TreeIter -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 381 -customTreeModelRefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () -customTreeModelRefNode_static storePtr iterPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceRefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () +treeModelIfaceRefNode_static storePtr iterPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 385 - customTreeModelRefNode store iter + treeModelIfaceRefNode store iter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 388 - customTreeModelRefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () + treeModelIfaceRefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 391 -customTreeModelUnrefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () -customTreeModelUnrefNode_static storePtr iterPtr = do - store <- deRefStablePtr storePtr +treeModelIfaceUnrefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () +treeModelIfaceUnrefNode_static storePtr iterPtr = do + store <- liftM customTreeModelIface $ deRefStablePtr storePtr hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 395 - customTreeModelUnrefNode store iter + treeModelIfaceUnrefNode store iter hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 398 - customTreeModelUnrefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () + treeModelIfaceUnrefNode_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr TreeIter -> IO () + +treeDragSourceRowDraggable_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> IO CInt +treeDragSourceRowDraggable_static storePtr pathPtr = do + store <- liftM customTreeDragSourceIface $ deRefStablePtr storePtr + path <- peekTreePath pathPtr + liftM fromBool $ treeDragSourceRowDraggable store path + +foreign export ccall "gtk2hs_store_row_draggable_impl" + treeDragSourceRowDraggable_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> IO CInt + +treeDragSourceDragDataGet_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt +treeDragSourceDragDataGet_static storePtr pathPtr selectionPtr = do + store <- liftM customTreeDragSourceIface $ deRefStablePtr storePtr + path <- peekTreePath pathPtr + liftM fromBool $ runReaderT (treeDragSourceDragDataGet store path) selectionPtr + +foreign export ccall "gtk2hs_store_drag_data_get_impl" + treeDragSourceDragDataGet_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt + +treeDragSourceDragDataDelete_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> IO CInt +treeDragSourceDragDataDelete_static storePtr pathPtr = do + store <- liftM customTreeDragSourceIface $ deRefStablePtr storePtr + path <- peekTreePath pathPtr + liftM fromBool $ treeDragSourceDragDataDelete store path + +foreign export ccall "gtk2hs_store_drag_data_delete_impl" + treeDragSourceDragDataDelete_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> IO CInt + +treeDragDestDragDataReceived_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt +treeDragDestDragDataReceived_static storePtr pathPtr selectionPtr = do + store <- liftM customTreeDragDestIface $ deRefStablePtr storePtr + path <- peekTreePath pathPtr + liftM fromBool $ runReaderT (treeDragDestDragDataReceived store path) selectionPtr + +foreign export ccall "gtk2hs_store_drag_data_received_impl" + treeDragDestDragDataReceived_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt + +treeDragDestRowDropPossible_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt +treeDragDestRowDropPossible_static storePtr pathPtr selectionPtr = do + store <- liftM customTreeDragDestIface $ deRefStablePtr storePtr + path <- peekTreePath pathPtr + liftM fromBool $ runReaderT (treeDragDestRowDropPossible store path) selectionPtr + +foreign export ccall "gtk2hs_store_row_drop_possible_impl" + treeDragDestRowDropPossible_static :: StablePtr (CustomTreeModelImplementation row) -> Ptr NativeTreePath -> SelectionData -> IO CInt hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 14 +static void gtk2hs_store_tree_drag_source_init (GtkTreeDragSourceIface *iface); +static void gtk2hs_store_tree_drag_dest_init (GtkTreeDragDestIface *iface); hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 50 +/* The TreeSortable interface is currently not implemented and may never be. +static gbooelan gtk2hs_store_get_sort_column_id (GtkTreeSortable *sortable, + gint sort_column_id, + GtkSortType *order); +static void gtk2hs_store_set_sort_column_id (GtkTreeSortable *sortable, + gint sort_column_id, + GtkSortType order); +static void gtk2hs_store_set_sort_func (GtkTreeSortable *sortable, + gint sort_column_id, + GtkTreeIterCompareFunc func, + gpointer data, + GtkDestroyNotify destroy); +static void gtk2hs_store_set_default_sort_func (GtkTreeSortable *sortable, + GtkTreeIterCompareFunc func, + gpointer data, + GtkDestroyNotify destroy); +static gboolean gtk2hs_store_has_default_sort_func (GtkTreeSortable *sortable); +*/ hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 69 +static gboolean gtk2hs_store_row_draggable (GtkTreeDragSource *drag_source, + GtkTreePath *path); +static gboolean gtk2hs_store_drag_data_get (GtkTreeDragSource *drag_source, + GtkTreePath *path, + GtkSelectionData *selection_data); +static gboolean gtk2hs_store_drag_data_delete (GtkTreeDragSource *drag_source, + GtkTreePath *path); +static gboolean gtk2hs_store_drag_data_received (GtkTreeDragDest *drag_dest, + GtkTreePath *dest_path, + GtkSelectionData *selection_data); +static gboolean gtk2hs_store_row_drop_possible (GtkTreeDragDest *drag_dest, + GtkTreePath *dest_path, + GtkSelectionData *selection_data); + [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 121 +/* The TreeSortable interface is currently not implemented. + static const GInterfaceInfo tree_sortable_info = + { + (GInterfaceInitFunc) gtk2hs_store_tree_sortable_init, + NULL, + NULL + }; +*/ + static const GInterfaceInfo tree_drag_source_info = + { + (GInterfaceInitFunc) gtk2hs_store_tree_drag_source_init, + NULL, + NULL + }; + + static const GInterfaceInfo tree_drag_dest_info = + { + (GInterfaceInitFunc) gtk2hs_store_tree_drag_dest_init, + NULL, + NULL + }; + hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 150 + [_$_] +/* The TreeSortable interface is currently not implemented. + g_type_add_interface_static (gtk2hs_store_type, + GTK_TYPE_TREE_SORTABLE, + &tree_sortable_info); +*/ + [_$_] + g_type_add_interface_static (gtk2hs_store_type, + GTK_TYPE_TREE_DRAG_SOURCE, + &tree_drag_source_info); + [_$_] + g_type_add_interface_static (gtk2hs_store_type, + GTK_TYPE_TREE_DRAG_DEST, + &tree_drag_dest_info); hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 217 +/** + * + * gtk2hs_store_tree_sortable_init: init callback for the interface registration + * in gtk2hs_store_get_type. Here we override + * the GtkTreeSortable interface functions that + * we implement. + * + **/ +/* The TreeSortable interface is currently not implemented. +static void +gtk2hs_store_tree_sortable_init (GtkTreeModelIface *iface) +{ + WHEN_DEBUG(g_debug("calling gtk2hs_store_tree_sortable_init\t(%p)\n", iface)); + iface->get_sort_column_id = gtk2hs_store_get_sort_column_id; + iface->set_sort_column_id = gtk2hs_store_set_sort_column_id; + iface->set_sort_func = gtk2hs_store_set_sort_func; + iface->set_default_sort_func = gtk2hs_store_set_default_sort_func; + iface->has_default_sort_func = gtk2hs_store_has_default_sort_func; +} +*/ + +/** + * + * gtk2hs_store_tree_drag_source_init: init callback for the interface registration + * in gtk2hs_store_get_type. Here we override + * the GtkTreeDragSource interface functions that + * we implement. + * + **/ +static void +gtk2hs_store_tree_drag_source_init (GtkTreeDragSourceIface *iface) +{ + WHEN_DEBUG(g_debug("calling gtk2hs_store_tree_drag_source_init\t(%p)\n", iface)); + iface->row_draggable = gtk2hs_store_row_draggable; + iface->drag_data_get = gtk2hs_store_drag_data_get; + iface->drag_data_delete = gtk2hs_store_drag_data_delete; +} + +/** + * + * gtk2hs_store_tree_drag_dest_init: init callback for the interface registration + * in gtk2hs_store_get_type. Here we override + * the GtkTreeDragDest interface functions that + * we implement. + * + **/ +static void +gtk2hs_store_tree_drag_dest_init (GtkTreeDragDestIface *iface) +{ + WHEN_DEBUG(g_debug("calling gtk2hs_store_tree_drag_dest_init\t(%p)\n", iface)); + iface->drag_data_received = gtk2hs_store_drag_data_received; + iface->row_drop_possible = gtk2hs_store_row_drop_possible; +} hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 625 + +static gboolean +gtk2hs_store_row_draggable (GtkTreeDragSource *drag_source, + GtkTreePath *path) { + WHEN_DEBUG( + gchar *path_str = gtk_tree_path_to_string(path); + g_debug("calling gtk2hs_store_row_draggable\t\t(%p, \"%s\")\n", drag_source, path_str); + g_free(path_str); + ) + Gtk2HsStore *store = (Gtk2HsStore *) drag_source; + g_return_val_if_fail (GTK2HS_IS_STORE (drag_source), FALSE); + [_$_] + gboolean result = gtk2hs_store_row_draggable_impl(store->impl, path); + WHEN_DEBUG(g_debug("return gtk2hs_store_row_draggable\t\t=%s\n", result ? "TRUE" : "FALSE")); + return result; +} + +static gboolean +gtk2hs_store_drag_data_get (GtkTreeDragSource *drag_source, + GtkTreePath *path, + GtkSelectionData *selection_data) { + WHEN_DEBUG( + gchar *path_str = gtk_tree_path_to_string(path); + g_debug("calling gtk2hs_store_drag_data_get\t\t(%p, \"%s\", %p)\n", drag_source, path_str, selection_data); + g_free(path_str); + ) + Gtk2HsStore *store = (Gtk2HsStore *) drag_source; + g_return_val_if_fail (GTK2HS_IS_STORE (drag_source), FALSE); + g_return_val_if_fail (selection_data!=NULL, FALSE); + [_$_] + gboolean result = gtk2hs_store_drag_data_get_impl(store->impl, path, selection_data); + WHEN_DEBUG(g_debug("return gtk2hs_store_drag_data_get\t\t=%s\n", result ? "TRUE" : "FALSE")); + return result; +} + +static gboolean +gtk2hs_store_drag_data_delete (GtkTreeDragSource *drag_source, + GtkTreePath *path) { + WHEN_DEBUG( + gchar *path_str = gtk_tree_path_to_string(path); + g_debug("calling gtk2hs_store_drag_data_delete\t\t(%p, \"%s\")\n", drag_source, path_str); + g_free(path_str); + ) + Gtk2HsStore *store = (Gtk2HsStore *) drag_source; + g_return_val_if_fail (GTK2HS_IS_STORE (drag_source), FALSE); + + gboolean result = gtk2hs_store_drag_data_delete_impl(store->impl, path); + WHEN_DEBUG(g_debug("return gtk2hs_store_drag_data_delete\t\t=%s\n", result ? "TRUE" : "FALSE")); + return result; +} + +static gboolean +gtk2hs_store_drag_data_received (GtkTreeDragDest *drag_dest, + GtkTreePath *dest_path, + GtkSelectionData *selection_data) { + WHEN_DEBUG( + gchar *path_str = gtk_tree_path_to_string(dest_path); + g_debug("calling gtk2hs_store_drag_data_received\t\t(%p, \"%s\", %p)\n", drag_dest, path_str, selection_data); + g_free(path_str); + ) + Gtk2HsStore *store = (Gtk2HsStore *) drag_dest; + g_return_val_if_fail (GTK2HS_IS_STORE (drag_dest), FALSE); + g_return_val_if_fail (selection_data!=NULL, FALSE); + + gboolean result = gtk2hs_store_drag_data_received_impl(store->impl, dest_path, selection_data); + WHEN_DEBUG(g_debug("return gtk2hs_store_drag_data_received\t\t=%s\n", result ? "TRUE" : "FALSE")); + return result; +} + +static gboolean +gtk2hs_store_row_drop_possible (GtkTreeDragDest *drag_dest, + GtkTreePath *dest_path, + GtkSelectionData *selection_data) { + WHEN_DEBUG( + gchar *path_str = gtk_tree_path_to_string(dest_path); + g_debug("calling gtk2hs_store_row_drop_possible\t\t(%p, \"%s\", %p)\n", drag_dest, path_str, selection_data); + g_free(path_str); + ) + Gtk2HsStore *store = (Gtk2HsStore *) drag_dest; + g_return_val_if_fail (GTK2HS_IS_STORE (drag_dest), FALSE); + g_return_val_if_fail (selection_data!=NULL, FALSE); + + gboolean result = gtk2hs_store_row_drop_possible_impl(store->impl, dest_path, selection_data); + WHEN_DEBUG(g_debug("return gtk2hs_store_row_drop_possible\t\t=%s\n", result ? "TRUE" : "FALSE")); + return result; +} hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.h 5 +#include <gtk/gtktreednd.h> hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 75 - cMap <- columnMapNew hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 76 - liftM ListStore $ customTreeModelNew rows CustomTreeModelImplementation { - customTreeModelGetFlags = return [TreeModelListOnly], - customTreeModelColumns = cMap, - customTreeModelGetIter = \[n] -> readIORef rows >>= \rows -> + liftM ListStore $ customTreeModelNew rows TreeModelIface { + treeModelIfaceGetFlags = return [TreeModelListOnly], + treeModelIfaceGetIter = \[n] -> readIORef rows >>= \rows -> hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 81 - customTreeModelGetPath = \(TreeIter _ n _ _) -> return [fromIntegral n], - customTreeModelGetRow = \(TreeIter _ n _ _) -> + treeModelIfaceGetPath = \(TreeIter _ n _ _) -> return [fromIntegral n], + treeModelIfaceGetRow = \(TreeIter _ n _ _) -> hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 88 - customTreeModelIterNext = \(TreeIter _ n _ _) -> + treeModelIfaceIterNext = \(TreeIter _ n _ _) -> hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 93 - customTreeModelIterChildren = \_ -> return Nothing, - customTreeModelIterHasChild = \_ -> return False, - customTreeModelIterNChildren = \index -> readIORef rows >>= \rows -> + treeModelIfaceIterChildren = \_ -> return Nothing, + treeModelIfaceIterHasChild = \_ -> return False, + treeModelIfaceIterNChildren = \index -> readIORef rows >>= \rows -> hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 99 - customTreeModelIterNthChild = \index n -> case index of + treeModelIfaceIterNthChild = \index n -> case index of hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 102 - customTreeModelIterParent = \_ -> return Nothing, - customTreeModelRefNode = \_ -> return (), - customTreeModelUnrefNode = \_ -> return () - } + treeModelIfaceIterParent = \_ -> return Nothing, + treeModelIfaceRefNode = \_ -> return (), + treeModelIfaceUnrefNode = \_ -> return () + } Nothing Nothing hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 105 - cMap <- columnMapNew hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 106 - liftM TreeStore $ customTreeModelNew storeRef CustomTreeModelImplementation { - customTreeModelGetFlags = return [], + liftM TreeStore $ customTreeModelNew storeRef TreeModelIface { + treeModelIfaceGetFlags = return [], hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 109 - customTreeModelColumns = cMap, - - customTreeModelGetIter = \path -> withStore $ + treeModelIfaceGetIter = \path -> withStore $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 112 - customTreeModelGetPath = \iter -> withStore $ + treeModelIfaceGetPath = \iter -> withStore $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 115 - customTreeModelGetRow = \iter -> withStoreUpdateCache $ + treeModelIfaceGetRow = \iter -> withStoreUpdateCache $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 122 - customTreeModelIterNext = \iter -> withStoreUpdateCache $ + treeModelIfaceIterNext = \iter -> withStoreUpdateCache $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 125 - customTreeModelIterChildren = \mIter -> withStoreUpdateCache $ + treeModelIfaceIterChildren = \mIter -> withStoreUpdateCache $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 130 - customTreeModelIterHasChild = \iter -> withStoreUpdateCache $ + treeModelIfaceIterHasChild = \iter -> withStoreUpdateCache $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 135 - customTreeModelIterNChildren = \mIter -> withStoreUpdateCache $ + treeModelIfaceIterNChildren = \mIter -> withStoreUpdateCache $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 140 - customTreeModelIterNthChild = \mIter idx -> withStoreUpdateCache $ + treeModelIfaceIterNthChild = \mIter idx -> withStoreUpdateCache $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 145 - customTreeModelIterParent = \iter -> withStore $ + treeModelIfaceIterParent = \iter -> withStore $ hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 148 - customTreeModelRefNode = \_ -> return (), - customTreeModelUnrefNode = \_ -> return () - } + treeModelIfaceRefNode = \_ -> return (), + treeModelIfaceUnrefNode = \_ -> return () + } Nothing Nothing |
From: Axel S. <A....@ke...> - 2007-12-02 21:38:34
|
Sun Dec 2 13:36:57 PST 2007 A....@ke... * Update TreeView and TreeViewColumn with new functions. hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1129 + + +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:88cb d:65c9 +-- | Returns whether all header columns are clickable. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewGetHeadersClickable :: TreeViewClass self => self + -> IO Bool -- ^ returns @True@ if all header columns are clickable, otherwise + -- @False@ +treeViewGetHeadersClickable self = + liftM toBool $ + {# call gtk_tree_view_get_headers_clickable #} + (toTreeView self) +#endif + +#if GTK_CHECK_VERSION(2,8,0) +-- %hash c:1d81 d:3587 +-- | Return the first and last visible path. +-- Note that there may be invisible paths in between. +-- +-- * Available since Gtk+ version 2.8 +-- +treeViewGetVisibleRange :: TreeViewClass self => self + -> IO (TreePath, TreePath) -- ^ the first and the last node that is visible +treeViewGetVisibleRange self = alloca $ \startPtr -> alloca $ \endPtr -> do + valid <- liftM toBool $ + {# call gtk_tree_view_get_visible_range #} + (toTreeView self) (castPtr startPtr) (castPtr endPtr) + if not valid then return ([],[]) else do + startTPPtr <- peek startPtr + endTPPtr <- peek endPtr + startPath <- fromTreePath startTPPtr + endPath <- fromTreePath endTPPtr + return (startPath, endPath) + [_$_] +#endif + +-- %hash c:61e1 d:3a0a +-- | Turns @treeView@ into a drop destination for automatic DND. +-- +treeViewEnableModelDragDest :: TreeViewClass self => self + -> TargetList -- ^ @targets@ - the list of targets that the + -- the view will support + -> [DragAction] -- ^ @actions@ - flags denoting the possible actions + -- for a drop into this widget + -> IO () +treeViewEnableModelDragDest self targets actions = + alloca $ \nTargetsPtr -> do + tlPtr <- {#call unsafe gtk_target_table_new_from_list#} targets nTargetsPtr + nTargets <- peek nTargetsPtr + {# call gtk_tree_view_enable_model_drag_dest #} + (toTreeView self) + tlPtr + nTargets + ((fromIntegral . fromFlags) actions) + {#call unsafe gtk_target_table_free#} tlPtr nTargets + +-- %hash c:1df9 d:622 +-- | Turns @treeView@ into a drag source for automatic DND. +-- +treeViewEnableModelDragSource :: TreeViewClass self => self + -> [Modifier] -- ^ @startButtonMask@ - Mask of allowed buttons + -- to start drag + -> TargetList -- ^ @targets@ - the list of targets that the + -- the view will support + -> [DragAction] -- ^ @actions@ - flags denoting the possible actions + -- for a drag from this widget + -> IO () +treeViewEnableModelDragSource self startButtonMask targets actions = + alloca $ \nTargetsPtr -> do + tlPtr <- {#call unsafe gtk_target_table_new_from_list#} targets nTargetsPtr + nTargets <- peek nTargetsPtr + {# call gtk_tree_view_enable_model_drag_source #} + (toTreeView self) + ((fromIntegral . fromFlags) startButtonMask) + tlPtr + nTargets + ((fromIntegral . fromFlags) actions) + {#call unsafe gtk_target_table_free#} tlPtr nTargets + [_$_] +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:3355 d:3bbe +-- | Returns the 'Entry' which is currently in use as interactive search entry +-- for @treeView@. In case the built-in entry is being used, @Nothing@ will be +-- returned. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewGetSearchEntry :: TreeViewClass self => self + -> IO (Maybe Entry) -- ^ returns the entry currently in use as search entry. +treeViewGetSearchEntry self = do + ePtr <- {# call gtk_tree_view_get_search_entry #} + (toTreeView self) + if ePtr==nullPtr then return Nothing else liftM Just $ + makeNewObject mkEntry (return ePtr) + +-- %hash c:5e11 d:8ec5 +-- | Sets the entry which the interactive search code will use for this +-- @treeView@. This is useful when you want to provide a search entry in our +-- interface at all time at a fixed position. Passing @Nothing@ for @entry@ +-- will make the interactive search code use the built-in popup entry again. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewSetSearchEntry :: (TreeViewClass self, EntryClass entry) => self + -> (Maybe entry) + -- ^ @entry@ - the entry the interactive search code of @treeView@ + -- should use or @Nothing@ + -> IO () +treeViewSetSearchEntry self (Just entry) = + {# call gtk_tree_view_set_search_entry #} + (toTreeView self) + (toEntry entry) +treeViewSetSearchEntry self Nothing = + {# call gtk_tree_view_set_search_entry #} + (toTreeView self) + (mkEntry nullForeignPtr) +#endif + +#if GTK_CHECK_VERSION(2,6,0) +-- %hash c:6326 d:a050 +-- | Sets the row separator function, which is used to determine whether a row +-- should be drawn as a separator. If the row separator function is @Nothing@, +-- no separators are drawn. This is the default value. +-- +-- * Available since Gtk+ version 2.6 +-- +treeViewSetRowSeparatorFunc :: TreeViewClass self => self + -> Maybe (TreeIter -> IO Bool) -- ^ @func@ - a callback function that + -- returns @True@ if the given row of + -- the model should be drawn as separator + -> IO () +treeViewSetRowSeparatorFunc self Nothing = + {# call gtk_tree_view_set_row_separator_func #} + (toTreeView self) nullFunPtr nullPtr nullFunPtr +treeViewSetRowSeparatorFunc self (Just func) = do + funcPtr <- mkTreeViewRowSeparatorFunc $ \_ tiPtr _ -> do + ti <- peekTreeIter tiPtr + liftM fromBool $ func ti + destroyPtr <- mkFunPtrDestroyNotify funcPtr + {# call gtk_tree_view_set_row_separator_func #} + (toTreeView self) funcPtr nullPtr destroyPtr + +{#pointer TreeViewRowSeparatorFunc #} + +foreign import ccall "wrapper" mkTreeViewRowSeparatorFunc :: + (Ptr TreeModel -> Ptr TreeIter -> Ptr () -> IO {#type gboolean#}) -> + IO TreeViewRowSeparatorFunc + [_$_] +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:778a d:eacd +-- | Returns whether rubber banding is turned on for @treeView@. If the +-- selection mode is 'SelectionMultiple', rubber banding will allow the user to +-- select multiple rows by dragging the mouse. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewGetRubberBanding :: TreeViewClass self => self + -> IO Bool -- ^ returns @True@ if rubber banding in @treeView@ is enabled. +treeViewGetRubberBanding self = + liftM toBool $ + {# call gtk_tree_view_get_rubber_banding #} + (toTreeView self) + +-- %hash c:4a69 d:93aa +-- | Enables or disables rubber banding in @treeView@. If the selection mode +-- is 'SelectionMultiple', rubber banding will allow the user to select +-- multiple rows by dragging the mouse. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewSetRubberBanding :: TreeViewClass self => self + -> Bool -- ^ @enable@ - @True@ to enable rubber banding + -> IO () +treeViewSetRubberBanding self enable = + {# call gtk_tree_view_set_rubber_banding #} + (toTreeView self) + (fromBool enable) + +-- %hash c:c8f8 d:c47 +-- | Returns whether or not tree lines are drawn in @treeView@. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewGetEnableTreeLines :: TreeViewClass self => self + -> IO Bool -- ^ returns @True@ if tree lines are drawn in @treeView@, @False@ + -- otherwise. +treeViewGetEnableTreeLines self = + liftM toBool $ + {# call gtk_tree_view_get_enable_tree_lines #} + (toTreeView self) + +-- %hash c:205d d:1df9 +-- | Sets whether to draw lines interconnecting the expanders in @treeView@. +-- This does not have any visible effects for lists. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewSetEnableTreeLines :: TreeViewClass self => self + -> Bool -- ^ @enabled@ - @True@ to enable tree line drawing, @False@ + -- otherwise. + -> IO () +treeViewSetEnableTreeLines self enabled = + {# call gtk_tree_view_set_enable_tree_lines #} + (toTreeView self) + (fromBool enabled) + +-- | Grid lines. +{#enum TreeViewGridLines {underscoreToCase}#} + +-- %hash c:cd40 d:fe96 +-- | Returns which grid lines are enabled in @treeView@. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewGetGridLines :: TreeViewClass self => self + -> IO TreeViewGridLines -- ^ returns a 'TreeViewGridLines' value indicating + -- which grid lines are enabled. +treeViewGetGridLines self = + liftM (toEnum . fromIntegral) $ + {# call gtk_tree_view_get_grid_lines #} + (toTreeView self) + +-- %hash c:74b0 d:79f0 +-- | Sets which grid lines to draw in @treeView@. +-- +-- * Available since Gtk+ version 2.10 +-- +treeViewSetGridLines :: TreeViewClass self => self + -> TreeViewGridLines -- ^ @gridLines@ - a 'TreeViewGridLines' value + -- indicating which grid lines to enable. + -> IO () +treeViewSetGridLines self gridLines = + {# call gtk_tree_view_set_grid_lines #} + (toTreeView self) + ((fromIntegral . fromEnum) gridLines) +#endif +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeViewColumn.chs.pp 78 - treeViewColumnAddAttribute, - treeViewColumnAddAttributes, - treeViewColumnSetAttributes, - treeViewColumnClearAttributes, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeViewColumn.chs.pp 211 --- | Insert an attribute to change the behaviour of the column's cell renderer. --- --- * The 'CellRenderer' @cr@ must already be in [_$_] --- 'TreeViewColumn'. --- -treeViewColumnAddAttribute :: CellRendererClass cellRenderer => TreeViewColumn - -> cellRenderer - -> String - -> Int - -> IO () -treeViewColumnAddAttribute self cellRenderer attribute column = - withUTFString attribute $ \attributePtr -> - {# call unsafe tree_view_column_add_attribute #} - self - (toCellRenderer cellRenderer) - attributePtr - (fromIntegral column) - --- | Insert attributes @attribs@ to change the behaviour of column @tvc@'s cell --- renderer @cr@. --- -treeViewColumnAddAttributes :: CellRendererClass cr => TreeViewColumn - -> cr - -> [(String,Int)] - -> IO () -treeViewColumnAddAttributes self cr attribs = [_$_] - mapM_ (\ (attr, col) -> treeViewColumnAddAttribute self cr attr col) attribs - --- | Set the attributes of the cell renderer @cr@ in the tree column @tvc@ --- be @attribs@. The attributes are given as a list of attribute\/column pairs. --- All existing attributes are removed, and replaced with the new attributes. --- -treeViewColumnSetAttributes :: CellRendererClass cr => TreeViewColumn - -> cr - -> [(String, Int)] - -> IO () -treeViewColumnSetAttributes self cr attribs = do - treeViewColumnClearAttributes self cr - treeViewColumnAddAttributes self cr attribs - --- | Clears all existing attributes --- of the column @tvc@. --- -treeViewColumnClearAttributes :: CellRendererClass cellRenderer => TreeViewColumn - -> cellRenderer - -> IO () -treeViewColumnClearAttributes self cellRenderer = - {# call tree_view_column_clear_attributes #} - self - (toCellRenderer cellRenderer) - |
From: Axel S. <A....@ke...> - 2007-11-19 19:46:22
|
Sun Nov 18 04:32:31 PST 2007 Bit Connor <bi...@mu...> * Add Gdk Cursor module hunk ./Makefile.am 572 + gtk/Graphics/UI/Gtk/Gdk/Cursor.chs \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 53 + module Graphics.UI.Gtk.Gdk.Cursor, hunk ./gtk/Graphics/UI/Gtk.hs.pp 230 +import Graphics.UI.Gtk.Gdk.Cursor addfile ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Cursor +-- +-- Author : Bit Connor <bi...@mu...> +-- +-- Created: 18 November 2007 +-- +-- Copyright (C) 2007 Bit Connor +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library 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 +-- Lesser General Public License for more details. +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Cursors | Standard and pixmap cursors. +-- +module Graphics.UI.Gtk.Gdk.Cursor ( + Cursor(..), + cursorNewFromPixmap + ) where + +import System.Glib.FFI +import Foreign.ForeignPtr (ForeignPtr, castForeignPtr, unsafeForeignPtrToPtr) +{#import Graphics.UI.Gtk.Types#} +import Graphics.UI.Gtk.General.Structs + +{#context lib="gdk" prefix ="gdk"#} + +{#pointer *Cursor foreign newtype #} + +makeNewCursor :: Ptr Cursor -> IO Cursor +makeNewCursor rPtr = do + cursor <- newForeignPtr rPtr cursor_unref + return (Cursor cursor) + +foreign import ccall unsafe "&gdk_cursor_unref" + cursor_unref :: FinalizerPtr Cursor + +-- | Creates a new cursor from a given pixmap and mask. Both the pixmap and +-- mask must have a depth of 1 (i.e. each pixel has only 2 values - on or off). +-- The standard cursor size is 16 by 16 pixels. +-- +cursorNewFromPixmap :: + Pixmap -- ^ @source@ - the pixmap specifying the cursor. + -> Pixmap -- ^ @mask@ - the pixmap specifying the mask, which must be the + -- same size as source. + -> Color -- ^ @fg@ - the foreground color, used for the bits in the source + -- which are 1. The color does not have to be allocated first. + -> Color -- ^ @bg@ - the background color, used for the bits in the source + -- which are 0. The color does not have to be allocated first. + -> Int -- ^ @x@ - the horizontal offset of the \'hotspot\' of the cursor. + -> Int -- ^ @y@ - the vertical offset of the \'hotspot\' of the cursor. + -> IO Cursor +cursorNewFromPixmap source mask fg bg x y = + with fg $ \fgPtr -> + with bg $ \bgPtr -> do + rPtr <- {# call unsafe cursor_new_from_pixmap #} source mask (castPtr fgPtr) (castPtr bgPtr) (fromIntegral x) (fromIntegral y) + makeNewCursor rPtr + |
From: Axel S. <A....@ke...> - 2007-11-19 19:46:17
|
Sun Nov 18 04:34:25 PST 2007 Bit Connor <bi...@mu...> * Add to General Gdk: screen size querying, pointer grabbing, keyboard grabbing hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs 46 - Gravity(..) + Gravity(..), + GrabStatus(..), hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs 167 - [_$_] + +-- | Returned by 'pointerGrab' and 'keyboardGrab' to indicate success or the +-- reason for the failure of the grab attempt. +-- +-- [@GrabSuccess@] the resource was successfully grabbed. +-- +-- [@GrabAlreadyGrabbed@] the resource is actively grabbed by another client. +-- +-- [@GrabInvalidTime@] the resource was grabbed more recently than the +-- specified time. +-- +-- [@GrabNotViewable@] the grab window or the confine_to window are not +-- viewable. +-- +-- [@GrabFrozen@] the resource is frozen by an active grab of another client. +-- +{#enum GrabStatus {underscoreToCase} #} + hunk ./gtk/Graphics/UI/Gtk/Gdk/Gdk.chs 28 - beep, hunk ./gtk/Graphics/UI/Gtk/Gdk/Gdk.chs 29 + screenWidth, + screenHeight, + screenWidthMM, + screenHeightMM, + GrabStatus(..), + pointerGrab, + pointerUngrab, + pointerIsGrabbed, + keyboardGrab, + keyboardUngrab, + beep hunk ./gtk/Graphics/UI/Gtk/Gdk/Gdk.chs 42 +import Control.Monad (liftM) + +import System.Glib.Flags (fromFlags) +import System.Glib.FFI +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Gdk.Cursor#} (Cursor(..)) +import Graphics.UI.Gtk.Gdk.Events +import Graphics.UI.Gtk.Gdk.Enums (EventMask, GrabStatus(..)) + hunk ./gtk/Graphics/UI/Gtk/Gdk/Gdk.chs 64 +-- | Returns the width of the default screen in pixels. +-- +screenWidth :: IO Int +screenWidth = liftM fromIntegral $ {#call screen_width#} + +-- | Returns the height of the default screen in pixels. +-- +screenHeight :: IO Int +screenHeight = liftM fromIntegral $ {#call screen_height#} + +-- | Returns the width of the default screen in millimeters. Note that on many +-- X servers this value will not be correct. +-- +screenWidthMM :: IO Int +screenWidthMM = liftM fromIntegral $ {#call screen_width_mm#} + +-- | Returns the height of the default screen in millimeters. Note that on many +-- X servers this value will not be correct. +-- +screenHeightMM :: IO Int +screenHeightMM = liftM fromIntegral $ {#call screen_height_mm#} + +-- | Grabs the pointer (usually a mouse) so that all events are passed to this +-- application until the pointer is ungrabbed with 'pointerUngrab', or the grab +-- window becomes unviewable. This overrides any previous pointer grab by this +-- client. +-- +-- Pointer grabs are used for operations which need complete control over mouse +-- events, even if the mouse leaves the application. For example in GTK+ it is +-- used for Drag and Drop, for dragging the handle in the GtkHPaned and +-- GtkVPaned widgets, and for resizing columns in GtkCList widgets. +-- +-- Note that if the event mask of an X window has selected both button press +-- and button release events, then a button press event will cause an automatic +-- pointer grab until the button is released. X does this automatically since +-- most applications expect to receive button press and release events in +-- pairs. It is equivalent to a pointer grab on the window with @owner_events@ +-- set to @True@. +-- +-- If you set up anything at the time you take the grab that needs to be +-- cleaned up when the grab ends, you should handle the GdkEventGrabBroken +-- events that are emitted when the grab ends unvoluntarily. +-- +pointerGrab :: (DrawWindowClass window, DrawWindowClass confine_to) => + window -- ^ @window@ - the 'DrawWindow' which will own the grab (the grab + -- window). + -> Bool -- ^ @owner_events@ - if @False@ then all pointer events are + -- reported with respect to @window@ and are only reported if + -- selected by @event_mask@. If @True@ then pointer events for this + -- application are reported as normal, but pointer events outside + -- this application are reported with respect to @window@ and only + -- if selected by @event_mask@. In either mode, unreported events + -- are discarded. + -> [EventMask] -- ^ @event_mask@ - specifies the event mask, which is used in + -- accordance with @owner_events@. Note that only pointer + -- events (i.e. button and motion events) may be selected. + -> Maybe confine_to -- ^ @confine_to@ If supplied, the pointer will be + -- confined to this window during the grab. If the + -- pointer is outside @confine_to@, it will automatically + -- be moved to the closest edge of @confine_to@ and enter + -- and leave events will be generated as necessary. + -> Maybe Cursor -- ^ @cursor@ - the cursor to display while the grab is + -- active. If this is @Nothing@ then the normal cursors are + -- used for @window@ and its descendants, and the cursor for + -- @window@ is used for all other windows. + -> TimeStamp -- ^ @time@ - the timestamp of the event which led to this + -- pointer grab. This usually comes from an 'Event', though + -- 'currentTime' can be used if the time isn't known. + -> IO GrabStatus -- ^ @Returns@ - 'GrabSuccess' if the grab was successful. +pointerGrab window owner_events event_mask mbConfine_to mbCursor time = + liftM (toEnum . fromIntegral) $ + {#call pointer_grab#} + (toDrawWindow window) + (fromBool owner_events) + (fromIntegral $ fromFlags event_mask) + (maybe (mkDrawWindow nullForeignPtr) toDrawWindow mbConfine_to) + (maybe (Cursor nullForeignPtr) id mbCursor) + (fromIntegral time) + +-- | Ungrabs the pointer on the default display, if it is grabbed by this +-- application. +-- +pointerUngrab :: + TimeStamp -- ^ @time@ - a timestamp from an 'Event', or 'currentTime' if no + -- timestamp is available. + -> IO () +pointerUngrab time = {#call pointer_ungrab#} (fromIntegral time) + +-- | Returns @True@ if the pointer on the default display is currently grabbed +-- by this application. +-- +-- Note that this does not take the inmplicit pointer grab on button presses +-- into account. +-- +pointerIsGrabbed :: IO Bool +pointerIsGrabbed = liftM toBool $ {#call pointer_is_grabbed#} + +-- | Grabs the keyboard so that all events are passed to this application until +-- the keyboard is ungrabbed with 'keyboardUngrab'. This overrides any previous +-- keyboard grab by this client. +-- +-- If you set up anything at the time you take the grab that needs to be +-- cleaned up when the grab ends, you should handle the GdkEventGrabBroken +-- events that are emitted when the grab ends unvoluntarily. +keyboardGrab :: (DrawWindowClass window) => + window -- ^ @window@ - the 'DrawWindow' which will own the grab (the grab + -- window). + -> Bool -- ^ @owner_events@ - if @False@ then all keyboard events are + -- reported with respect to @window@. If @True@ then keyboard events + -- for this application are reported as normal, but keyboard events + -- outside this application are reported with respect to @window@. + -- Both key press and key release events are always reported, + -- independant of the event mask set by the application. + -> TimeStamp -- ^ @time@ - a timestamp from an 'Event', or 'currentTime' if + -- no timestamp is available. + -> IO GrabStatus -- ^ @Returns@ - 'GrabSuccess' if the grab was successful. +keyboardGrab window owner_events time = + liftM (toEnum . fromIntegral) $ + {#call keyboard_grab#} + (toDrawWindow window) + (fromBool owner_events) + (fromIntegral time) + +-- | Ungrabs the keyboard on the default display, if it is grabbed by this +-- application. +keyboardUngrab :: + TimeStamp -- ^ @time@ - a timestamp from an 'Event', or 'currentTime' if no + -- timestamp is available. + -> IO () +keyboardUngrab time = {#call keyboard_ungrab#} (fromIntegral time) + + |
From: Axel S. <A....@ke...> - 2007-11-19 19:46:17
|
Mon Nov 19 05:49:55 PST 2007 hth...@zo... * Tutorial Port Paned Windows and Aspect Frames (Chapt.4) addfile ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap6-4.hs hunk ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap6-4.hs 1 +import Graphics.UI.Gtk + +main :: IO () +main = do + initGUI + window <- windowNew + set window [windowTitle := "Paned Window", containerBorderWidth := 10, + windowDefaultWidth := 400, windowDefaultHeight := 400 ] + + pw <- vPanedNew + panedSetPosition pw 250 + containerAdd window pw + af <- aspectFrameNew 0.5 0.5 (Just 3.0) + frameSetLabel af "Aspect Ratio: 3.0" + frameSetLabelAlign af 1.0 0.0 + panedAdd1 pw af + + da <- drawingAreaNew + containerAdd af da + widgetModifyBg da StateNormal (Color 65535 0 0) + [_$_] + tv <- textViewNew + panedAdd2 pw tv + buf <- textViewGetBuffer tv + + onBufferChanged buf $ do cn <- textBufferGetCharCount buf + putStrLn (show cn) [_$_] + + widgetShowAll window [_$_] + onDestroy window mainQuit + mainGUI addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap6-4.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap6-4.png hunk ./docs/tutorial/Tutorial_Port/chap6-3.xhtml 180 - <br />6.4</span> + <br />6.4 Paned Windows and Aspect Frames</span> addfile ./docs/tutorial/Tutorial_Port/chap6-4.xhtml hunk ./docs/tutorial/Tutorial_Port/chap6-4.xhtml 1 +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8" /> + <title>Gtk2Hs Tutorial: Pained Windows and Aspect + Frames</title> + <link href="default.css" type="text/css" rel="stylesheet" /> + </head> + <body> + <div id="header"> + <h1>Gtk2Hs Tutorial</h1> + <span class="nav-previous"> + <a href="chap6-3.xhtml">Previous</a> + </span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <a href="chap7-1.xhtml">Next</a> + </span> + </div> + <h2>6.4 Paned Windows and Aspect Frames</h2> + <p>The paned window widgets are useful when you want to divide + an area into two parts, with the relative size of the two parts + controlled by the user. A groove is drawn between the two + portions, with a handle that the user can drag to change the + ratio. The division can either be horizontal, [_$_] + <code>HPaned</code>, or vertical, [_$_] + <code>VPaned</code>.</p> + <p>To create a new paned window, use one of:</p> + <pre class="codebox">hPanedNew :: IO HPaned +vPanedNew :: IO VPaned [_$_] +</pre> + <p>Set the position of the divider with:</p> + <pre class="codebox">panedSetPosition :: PanedClass self => self -> Int -> IO () +</pre> + <p>After creating the paned window widget, you need to add + child widgets to its two halves. </p> + <pre class="codebox">panedAdd1 :: (PanedClass self, WidgetClass child) => self -> child -> IO () +panedAdd2 :: (PanedClass self, WidgetClass child) => self -> child -> IO () +</pre> + <p>The first adds to the top (right) , the second to the bottom (left) half of the + paned window. If you don't want the children to expand or + resize with the paned widget use [_$_] + <code>panedPack1</code> and [_$_] + <code>panedPack2</code> instead.</p> + <p>An Aspect Frame is a frame for which you can define a + constant width/height ratio. This so called aspect ratio will + not change when the frame is resized. You create one with:</p> + <pre class="codebox">aspectFrameNew :: Float -> Float -> Maybe Float -> IO AspectFrame +</pre> + <p>The first parameter sets the horizontal alignment of the + child within the frame (between 0.0 and 1.0). The second does + the same for the vertical alignment. Optionally, you set the + desired aspect ratio with the third parameter. Since an [_$_] + <code>AspectFrame</code> widget is a [_$_] + <code>Frame</code> widget, you can also add a label.</p> + <p>In the following example we've created a vertical paned + window with an aspect frame in the top half.</p> + <img src="Images/GtkChap6-4.png" alt="Paned Window" + id="imgGtkChap6-4" /> + <p>We've created a [_$_] + <code>DrawingArea</code> widget in the [_$_] + <code>AspectFrame</code>. A [_$_] + <code>DrawingArea</code> is a blank widget, which can be used to + draw on, but here we just set the background color to + demonstrate the use of the [_$_] + <code>AspectFrame</code>. In the lower half of the [_$_] + <code>VPaned</code> widget we've created a [_$_] + <code>TextView</code> widget. This is a multi-line text + viewer and editor with many powerful features. Here, however, we + just take the associated text buffer and count the characters + whenever the user edits some text. </p> + <pre class="codebox"> +import Graphics.UI.Gtk + +main :: IO () +main = do + initGUI + window <- windowNew + set window [windowTitle := "Paned Window", containerBorderWidth := 10, + windowDefaultWidth := 400, windowDefaultHeight := 400 ] + + pw <- vPanedNew + panedSetPosition pw 250 + containerAdd window pw + af <- aspectFrameNew 0.5 0.5 (Just 3.0) + frameSetLabel af "Aspect Ratio: 3.0" + frameSetLabelAlign af 1.0 0.0 + panedAdd1 pw af + + da <- drawingAreaNew + containerAdd af da + widgetModifyBg da StateNormal (Color 65535 0 0) + [_$_] + tv <- textViewNew + panedAdd2 pw tv + buf <- textViewGetBuffer tv + + onBufferChanged buf $ do cn <- textBufferGetCharCount buf + putStrLn (show cn) [_$_] + + widgetShowAll window [_$_] + onDestroy window mainQuit + mainGUI +</pre> + <div id="footer"> + <span class="nav-previous"> + <a href="chap6-3.xhtml">Previous</a> + <br />6.3 The Layout Container</span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <a href="chap7-1.xhtml">Next</a> + <br />7.1</span> + </div> + </body> +</html> hunk ./docs/tutorial/Tutorial_Port/index.xhtml 100 + </li> [_$_] + <li> + <a href="chap6-4.xhtml">6.4 Paned Windows and Aspect Frames</a> |
From: Axel S. <A....@ke...> - 2007-11-19 19:46:14
|
Sun Nov 18 04:26:30 PST 2007 Bit Connor <bi...@mu...> * Add Gdk Event related 'currentTime' function (binding to GDK_CURRENT_TIME) hunk ./gtk/Graphics/UI/Gtk/Gdk/Events.hsc 30 + currentTime, hunk ./gtk/Graphics/UI/Gtk/Gdk/Events.hsc 138 +-- | Represents the current time, and can be used anywhere a time is expected. +currentTime :: TimeStamp +currentTime = #{const GDK_CURRENT_TIME} + |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:58
|
Fri Nov 9 07:29:40 PST 2007 hth...@zo... * Tutorial_Port: The Layout Container (Chapter 6.3) addfile ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap6-3.hs hunk ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap6-3.hs 1 +import Graphics.UI.Gtk + +main :: IO () +main = do + initGUI + window <- windowNew + set window [windowTitle := "Alphabet" , windowDefaultWidth := 350, + windowDefaultHeight := 350 , containerBorderWidth := 10] + sw <- scrolledWindowNew Nothing Nothing + set sw [scrolledWindowPlacement := CornerBottomRight, [_$_] + scrolledWindowShadowType := ShadowEtchedIn, + scrolledWindowHscrollbarPolicy := PolicyAutomatic, + scrolledWindowVscrollbarPolicy := PolicyAutomatic ] + containerAdd window sw + + layt <- layoutNew Nothing Nothing + layoutSetSize layt myLayoutWidth myLayoutHeight + widgetModifyBg layt StateNormal (Color 65535 65535 65535) + containerAdd sw layt [_$_] + [_$_] + upleft <- labelNew (Just "[_\e2_][_\80_][_\a1_](0,0)") + layoutPut layt upleft 0 0 + upright <- labelNew (Just ("[_\e2_][_\80_][_\a1_](" ++ (show (myLayoutWidth - 50)) ++",0)")) + layoutPut layt upright (myLayoutWidth -50) 0 + dwnright <- labelNew (Just ("[_\e2_][_\80_][_\a1_](0," ++ (show (myLayoutHeight -20)) ++ ")")) + layoutPut layt dwnright 0 (myLayoutHeight -20) + dwnleft <- labelNew (Just ("[_\e2_][_\80_][_\a1_](" ++ (show(myLayoutWidth -70)) ++ "," ++ + (show (myLayoutHeight -20)) ++ ")")) + layoutPut layt dwnleft (myLayoutWidth -70) (myLayoutHeight - 20) + [_$_] + labels <- sequence $ map (labelNew . Just) txtls + sequence_ $ map (\x -> widgetModifyFg x StateNormal (Color 0 0 45000)) labels + [_$_] + let wnums = zip labels [0..] + sequence_ $ map (myLayoutPut layt) wnums [_$_] + + widgetShowAll window + onDestroy window mainQuit + mainGUI + +-- parameters +myLayoutWidth :: Int +myLayoutWidth = 800 + +myLayoutHeight :: Int +myLayoutHeight = 800 + +txtls :: [String] +txtls = map (\x -> x:[]) ['A'..'Z'] +-- end parameters + +step :: Double +step = (2 * pi)/(fromIntegral (length txtls)) + +ox :: Int +ox = myLayoutWidth `div` 2 + +oy :: Int +oy = myLayoutHeight `div` 2 + +radius :: Double +radius = 0.25 * (fromIntegral ox) + +angle :: Int -> Double +angle num = 1.5 * pi + (fromIntegral num) * step + +num2x :: Int -> Int +num2x n = ox + relx where [_$_] + relx = round $ radius * (cos (angle n)) + +num2y :: Int -> Int +num2y n = oy + rely where + rely = round $ radius * (sin (angle n)) + +myLayoutPut :: Layout -> (Label, Int) -> IO () +myLayoutPut lt (lb, n) = do [_$_] + layoutPut lt lb (num2x n) (num2y n) [_$_] + labelSetAngle lb (letterAngle n) + +letterAngle :: Int -> Double +letterAngle n = (270 - degree) where + degree = (angle n) * (180.0 /pi) addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap6-3.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap6-3.png hunk ./docs/tutorial/Tutorial_Port/chap6-2.xhtml 21 - <a href="chap6-2.xhtml">Next</a> + <a href="chap6-3.xhtml">Next</a> hunk ./docs/tutorial/Tutorial_Port/chap6-2.xhtml 258 - <br />6.3</span> + <br />The Layout Container</span> addfile ./docs/tutorial/Tutorial_Port/chap6-3.xhtml hunk ./docs/tutorial/Tutorial_Port/chap6-3.xhtml 1 +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8" /> + <title>Gtk2Hs Tutorial: The Layout Container</title> + <link href="default.css" type="text/css" rel="stylesheet" /> + </head> + <body> + <div id="header"> + <h1>Gtk2Hs Tutorial</h1> + <span class="nav-previous"> + <a href="chap6-2.xhtml">Previous</a> + </span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <a href="chap6-4.xhtml">Next</a> + </span> + </div> + <h2>6.3 The Layout Container</h2> + <p>Until now packing of widgets has been done either through + sequencing in horizontal or vertical boxes, or in a table. You + can, however, also place widgets in any position you like, + using a [_$_] + <code>Fixed</code> or a [_$_] + <code>Layout</code> widget. Use of the [_$_] + <code>Fixed</code> container is not recommended, because it does + not resize well.</p> + <p>The Layout container is similar to the Fixed container + except that it implements an infinite (where infinity is less + than 2^32) scrolling area. The X window system has a limitation + where windows can be at most 32767 pixels wide or tall. The + Layout container gets around this by doing some + exotic stuff using window and bit gravities, so that you can + have smooth scrolling even when you have many child widgets in + your scrolling area. Since it is used in a scrolled window, the + disadvantages of the [_$_] + <code>Fixed</code> widget do not apply.</p> + <p>A Layout container is created using:</p> + <pre class="codebox">layoutNew :: Maybe Adjustment -> Maybe Adjustment -> IO Layout +</pre> + <p>As you can see, you can optionally specify the Adjustment + objects that the Layout widget will use for its scrolling.</p> + <p>You can add and move widgets in the Layout container using + the following two functions:</p> + <pre class="codebox">layoutPut :: (LayoutClass self, WidgetClass childWidget) +=> self -> childWidget -> Int -> Int -> IO () +layoutMove :: (LayoutClass self, WidgetClass childWidget) +=> self -> childWidget -> Int -> Int -> IO () [_$_] +</pre> + <p>The first argument is the x position, the second the y + position. The top left is (0,0), x grows from left to right, + and y from top to bottom.</p> + <p>The size of the [_$_] + <code>Layout</code> container can be set using the next + function:</p> + <pre class="codebox">layoutSetSize :: LayoutClass self => self -> Int -> Int -> IO () +</pre> + <p>The first argument is the width of the entire scrollable + area, the second the height.</p> + <p>In the example we place a list of labels, each with an upper + case letter of the alphabet, in a circle around a chosen + centre. The labels are positioned perpendicular to the radius + using the Gtk2Hs function:</p> + <pre class="codebox">labelSetAngle :: labelClass self => self -> Double -> IO () +</pre> + <p>The angle is in degrees, measured counterclockwise.</p> + <img src="Images/GtkChap6-3.png" alt="Alphabet" + id="imgGtkChap6-3" /> + <p>The layout widget is placed into a scrolled window with [_$_] + <code>containerAdd</code> because it is scrollable, and so does + not need a view port, as in Chapter 6.1. The labels are + positioned using angular coordinates, which are then + transformed into Cartesian coordinates with the Prelude [_$_] + <code>sin</code> and [_$_] + <code>cos</code> functions. These take radians as their + arguments (between 0 and (2 * pi)). Width and Height in the + example are parametrized, as is the list to be displayed. + Furthermore, in [_$_] + <code>main</code> the corners of the [_$_] + <code>Layout</code> are marked, so you can easily experiment with its + size, if you want. Note that the actual marker has been replaced with '+' here, because + the validator complained.</p> + <pre class="codebox">import Graphics.UI.Gtk + +main :: IO () +main = do + initGUI + window <- windowNew + set window [windowTitle := "Alphabet" , windowDefaultWidth := 350, + windowDefaultHeight := 350 , containerBorderWidth := 10] + sw <- scrolledWindowNew Nothing Nothing + set sw [scrolledWindowPlacement := CornerBottomRight, [_$_] + scrolledWindowShadowType := ShadowEtchedIn, + scrolledWindowHscrollbarPolicy := PolicyAutomatic, + scrolledWindowVscrollbarPolicy := PolicyAutomatic ] + containerAdd window sw + + layt <- layoutNew Nothing Nothing + layoutSetSize layt myLayoutWidth myLayoutHeight + widgetModifyBg layt StateNormal (Color 65535 65535 65535) + containerAdd sw layt [_$_] + [_$_] + upleft <- labelNew (Just "+(0,0)") + layoutPut layt upleft 0 0 + upright <- labelNew (Just ("+(" ++ (show (myLayoutWidth - 50)) ++",0)")) + layoutPut layt upright (myLayoutWidth -50) 0 + dwnright <- labelNew (Just ("+(0," ++ (show (myLayoutHeight -20)) ++ ")")) + layoutPut layt dwnright 0 (myLayoutHeight -20) + dwnleft <- labelNew (Just ("+(" ++ (show(myLayoutWidth -70)) ++ "," ++ + (show (myLayoutHeight -20)) ++ ")")) + layoutPut layt dwnleft (myLayoutWidth -70) (myLayoutHeight - 20) + [_$_] + labels <- sequence $ map (labelNew . Just) txtls + sequence_ $ map (\x -> widgetModifyFg x StateNormal (Color 0 0 45000)) labels + [_$_] + let wnums = zip labels [0..] + sequence_ $ map (myLayoutPut layt) wnums [_$_] + + widgetShowAll window + onDestroy window mainQuit + mainGUI + +-- parameters +myLayoutWidth :: Int +myLayoutWidth = 800 + +myLayoutHeight :: Int +myLayoutHeight = 800 + +txtls :: [String] +txtls = map (\x -> x:[]) ['A'..'Z'] +-- end parameters + +step :: Double +step = (2 * pi)/(fromIntegral (length txtls)) + +ox :: Int +ox = myLayoutWidth `div` 2 + +oy :: Int +oy = myLayoutHeight `div` 2 + +radius :: Double +radius = 0.25 * (fromIntegral ox) + +angle :: Int -> Double +angle num = 1.5 * pi + (fromIntegral num) * step + +num2x :: Int -> Int +num2x n = ox + relx where [_$_] + relx = round $ radius * (cos (angle n)) + +num2y :: Int -> Int +num2y n = oy + rely where + rely = round $ radius * (sin (angle n)) + +myLayoutPut :: Layout -> (Label, Int) -> IO () +myLayoutPut lt (lb, n) = do [_$_] + layoutPut lt lb (num2x n) (num2y n) [_$_] + labelSetAngle lb (letterAngle n) + +letterAngle :: Int -> Double +letterAngle n = (270 - degree) where + degree = (angle n) * (180.0 /pi) +</pre> + <div id="footer"> + <span class="nav-previous"> + <a href="chap6-1.xhtml">Previous</a> + <br />6.2 Event Boxes and Button Boxes</span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <a href="chap6-4.xhtml">Next</a> + <br />6.4</span> + </div> + </body> +</html> hunk ./docs/tutorial/Tutorial_Port/index.xhtml 98 + <li> + <a href="chap6-3.xhtml">6.3 The Layout Container</a> + </li> [_$_] |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:57
|
Fri Nov 9 21:25:45 PST 2007 Peter Gavin <pg...@gm...> * gstreamer: M.S.G.Bus: improve API, add documentation hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 29 +-- [_$_] +-- An asynchronous message bus subsystem. +-- [_$_] hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 33 - [_$_] +-- * Types [_$_] + -- | The 'Bus' is resposible for delivering 'Message's in a + -- first-in, first-out order, from the streaming threads to the + -- application. + -- [_$_] + -- Since the application typically only wants to deal with + -- delivery of these messages from one thread, the 'Bus' will + -- marshal the messages between different threads. This is + -- important since the actual streaming of media is done in + -- a thread separate from the application. + -- + -- The 'Bus' provides support for 'System.Glib.MainLoop.Source' + -- based notifications. This makes it possible to handle the + -- delivery in the GLib 'System.Glib.MainLoop.Source'. + -- + -- A message is posted on the bus with the 'busPost' method. With + -- the 'busPeek' and 'busPop' methods one can look at or retrieve + -- a previously posted message. + -- + -- The bus can be polled with the 'busPoll' method. This methods + -- blocks up to the specified timeout value until one of the + -- specified messages types is posted on the bus. The application + -- can then pop the messages from the bus to handle + -- them. Alternatively the application can register an + -- asynchronous bus function using 'busAddWatch'. This function + -- will install a 'System.Glib.MainLoop.Source' in the default + -- GLib main loop and will deliver messages a short while after + -- they have been posted. Note that the main loop should be + -- running for the asynchronous callbacks. + -- + -- It is also possible to get messages from the bus without any + -- thread marshalling with the 'busSetSyncHandler' method. This + -- makes it possible to react to a message in the same thread that + -- posted the message on the bus. This should only be used if the + -- application is able to deal with messages from different + -- threads. + -- [_$_] + -- Every 'Pipeline' has one bus. + -- + -- Note that a 'Pipeline' will set its bus into flushing state + -- when changing from 'StateReady' to 'StateNull'. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 75 + -- | The result of a 'BusSyncHandler'. + BusSyncReply, + -- | A handler that will be invoked synchronously when a new message + -- is injected into the bus. This function is mostly used internally. + -- Only one sync handler may be attached to a given bus. + BusSyncHandler, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 84 +-- * Bus Operations + busGetFlags, + busSetFlags, + busUnsetFlags, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 95 + busSetSyncHandler, + busUseSyncSignalHandler, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 99 + busDisableSyncMessageEmission, + busEnableSyncMessageEmission, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 105 +-- * Bus Signals hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 107 - afterBusMessage + afterBusMessage, + onBusSyncMessage, + afterBusSyncMessage hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 113 -import Control.Monad (liftM) +import Control.Monad ( liftM + , when ) +{#import Media.Streaming.GStreamer.Core.Object#} hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 126 +-- | Get the flags set on this bus. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 132 +-- | Set flags on this bus. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 139 +-- | Unset flags on this bus. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 146 +-- | Create a new bus. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 151 -busPost :: Bus +-- | Post a message to the bus. +busPost :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 158 - liftM toBool $ {# call bus_post #} bus message + liftM toBool $ {# call bus_post #} (toBus bus) message hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 160 -busHavePending :: Bus +-- | Check if there are pending messages on the bus. +busHavePending :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 165 - liftM toBool $ {# call bus_have_pending #} bus + liftM toBool $ {# call bus_have_pending #} $ toBus bus hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 167 -busPeek :: Bus +-- | Get the message at the front of the queue. It will remain on the +-- queue. +busPeek :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 173 - {# call bus_peek #} bus >>= maybePeek takeMiniObject + {# call bus_peek #} (toBus bus) >>= maybePeek takeMiniObject hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 175 -busPop :: Bus +-- | Get the message at the front of the queue. It will be removed +-- from the queue. +busPop :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 181 - {# call bus_pop #} bus >>= maybePeek takeMiniObject + {# call bus_pop #} (toBus bus) >>= maybePeek takeMiniObject hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 183 -busTimedPop :: Bus - -> ClockTime +-- | Get a message from the bus, waiting up to the specified timeout. +-- If the time given is 'Nothing', the function will wait forever. +-- If the time given is @0@, the function will behave like 'busPop'. +busTimedPop :: BusClass busT + => busT + -> Maybe ClockTime hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 190 -busTimedPop bus timeout = - {# call bus_timed_pop #} bus (fromIntegral timeout) >>= - maybePeek takeMiniObject +busTimedPop bus timeoutM = + let timeout = case timeoutM of + Just timeout' -> timeout' + Nothing -> clockTimeNone + in {# call bus_timed_pop #} (toBus bus) (fromIntegral timeout) >>= + maybePeek takeMiniObject hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 197 -busSetFlushing :: Bus +-- | If @flushing@ is 'True', the bus will flush out any queued +-- messages, as well as any future messages, until the function is +-- called with @flushing@ set to 'False'. +busSetFlushing :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 205 - {# call bus_set_flushing #} bus $ fromBool flushing + {# call bus_set_flushing #} (toBus bus) $ fromBool flushing + +-- these will leak memory, maybe one day we can set a destroy notifier... + +type CBusSyncHandler = Ptr Bus + -> Ptr Message + -> {# type gpointer #} + -> IO {# type GstBusSyncReply #} +marshalBusSyncHandler :: BusSyncHandler + -> IO {# type GstBusSyncHandler #} +marshalBusSyncHandler busSyncHandler = + makeBusSyncHandler cBusSyncHandler + where cBusSyncHandler :: CBusSyncHandler + cBusSyncHandler busPtr messagePtr _ = + do bus <- peekObject busPtr + message <- peekMiniObject messagePtr + reply <- busSyncHandler bus message + when (reply == BusDrop) $ + {# call gst_mini_object_unref #} (toMiniObject message) + return $ fromIntegral $ fromEnum reply +foreign import ccall "wrapper" + makeBusSyncHandler :: CBusSyncHandler + -> IO {# type GstBusSyncHandler #} + +-- the following mess is necessary to clean up safely after busSetSyncHandler. +-- gstreamer doesn't give us a nice way to do this (such as a DestroyNotify) +weakNotifyQuark, funPtrQuark :: Quark +weakNotifyQuark = unsafePerformIO $ quarkFromString "Gtk2HS::SyncHandlerWeakNotify" +funPtrQuark = unsafePerformIO $ quarkFromString "Gtk2HS::SyncHandlerFunPtr" + +getWeakNotify :: BusClass busT + => busT + -> IO (Maybe GWeakNotify) +getWeakNotify = objectGetAttributeUnsafe weakNotifyQuark hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 240 -busCreateWatch :: Bus +setWeakNotify :: BusClass busT + => busT + -> Maybe GWeakNotify + -> IO () +setWeakNotify = objectSetAttribute weakNotifyQuark + +getFunPtr :: BusClass busT + => busT + -> IO (Maybe {# type GstBusSyncHandler #}) +getFunPtr = objectGetAttributeUnsafe funPtrQuark + +setFunPtr :: BusClass busT + => busT + -> Maybe {# type GstBusSyncHandler #} + -> IO () +setFunPtr = objectSetAttribute funPtrQuark + +unsetSyncHandler :: BusClass busT + => busT + -> IO () +unsetSyncHandler bus = do + {# call bus_set_sync_handler #} (toBus bus) nullFunPtr nullPtr + oldWeakNotifyM <- getWeakNotify bus + case oldWeakNotifyM of + Just oldWeakNotify -> objectWeakunref bus oldWeakNotify + Nothing -> return () + setWeakNotify bus Nothing + oldFunPtrM <- getFunPtr bus + case oldFunPtrM of + Just oldFunPtr -> freeHaskellFunPtr oldFunPtr + Nothing -> return () + setFunPtr bus Nothing + +-- | Set the synchronous message handler on the bus. The function will +-- be called every time a new message is posted to the bus. Note +-- that the function will be called from the thread context of the +-- poster. +-- [_$_] +-- Calling this function will replace any previously set sync +-- handler. If 'Nothing' is passed to this function, it will unset +-- the handler. +busSetSyncHandler :: BusClass busT + => busT + -> Maybe BusSyncHandler + -> IO () +busSetSyncHandler bus busSyncHandlerM = do + objectWithLock bus $ do + unsetSyncHandler bus + case busSyncHandlerM of + Just busSyncHandler -> + do funPtr <- marshalBusSyncHandler busSyncHandler + setFunPtr bus $ Just funPtr + weakNotify <- objectWeakref bus $ freeHaskellFunPtr funPtr + setWeakNotify bus $ Just weakNotify + {# call bus_set_sync_handler #} (toBus bus) funPtr nullPtr + Nothing -> + return () + +-- | Use a synchronous message handler that converts all messages to signals. +busUseSyncSignalHandler :: BusClass busT + => busT + -> IO () +busUseSyncSignalHandler bus = do + objectWithLock bus $ do + unsetSyncHandler bus + {# call bus_set_sync_handler #} (toBus bus) cBusSyncSignalHandlerPtr nullPtr +foreign import ccall unsafe "&gst_bus_sync_signal_handler" + cBusSyncSignalHandlerPtr :: {# type GstBusSyncHandler #} + +-- | Create a watch for the bus. The 'Source' will dispatch a signal +-- whenever a message is on the bus. After the signal is dispatched, +-- the message is popped off the bus. +busCreateWatch :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 316 - liftM Source $ {# call bus_create_watch #} bus >>= + liftM Source $ {# call bus_create_watch #} (toBus bus) >>= hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 338 -busAddWatch :: Bus +-- | Adds a bus watch to the default main context with the given +-- priority. This function is used to receive asynchronous messages +-- in the main loop. +-- [_$_] +-- The watch can be removed by calling 'System.Glib.MainLoop.sourceRemove'. +busAddWatch :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 347 - -> IO Word + -> IO HandlerId hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 353 - bus + (toBus bus) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 359 -busAddSignalWatch :: Bus +-- | Instructs GStreamer to stop emitting the @"sync-message"@ signal +-- for this bus. See 'busEnableSyncMessageEmission' for more +-- information. +-- [_$_] +-- In the event that multiple pieces of code have called +-- 'busEnableSyncMessageEmission', the sync-message +-- emissions will only be stopped after all calls to +-- 'busEnableSyncMessageEmission' were "cancelled" by +-- calling this function. +busDisableSyncMessageEmission :: BusClass busT + => busT + -> IO () +busDisableSyncMessageEmission = + {# call bus_disable_sync_message_emission #} . toBus + +-- | Instructs GStreamer to emit the @"sync-message"@ signal after +-- running the bus's sync handler. This function is here so that +-- programmers can ensure that they can synchronously receive +-- messages without having to affect what the bin's sync handler is. +-- [_$_] +-- This function may be called multiple times. To clean up, the +-- caller is responsible for calling 'busDisableSyncMessageEmission' +-- as many times as this function is called. +-- [_$_] +-- While this function looks similar to 'busAddSignalWatch', it is +-- not exactly the same -- this function enables synchronous +-- emission of signals when messages arrive; 'busAddSignalWatch' +-- adds an idle callback to pop messages off the bus +-- asynchronously. The @"sync-message"@ signal comes from the thread +-- of whatever object posted the message; the @"message"@ signal is +-- marshalled to the main thread via the main loop. +busEnableSyncMessageEmission :: BusClass busT + => busT + -> IO () +busEnableSyncMessageEmission = + {# call bus_enable_sync_message_emission #} . toBus + +-- | Adds a bus signal watch to the default main context with the +-- given priority. After calling this method, the bus will emit the +-- @"message"@ signal for each message posted on the bus. +-- [_$_] +-- This function may be called multiple times. To clean up, the +-- caller is responsible for calling 'busRemoveSignalWatch' as many +-- times. +busAddSignalWatch :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 408 - {# call bus_add_signal_watch_full #} bus $ fromIntegral priority + {# call bus_add_signal_watch_full #} (toBus bus) $ fromIntegral priority hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 410 -busRemoveSignalWatch :: Bus +-- | Remove the signal watch that was added with 'busAddSignalWatch'. +busRemoveSignalWatch :: BusClass busT + => busT hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 415 - {# call bus_remove_signal_watch #} + {# call bus_remove_signal_watch #} . toBus hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 417 +-- | Poll the bus for a message. Will block while waiting for messages +-- to come. You can specify the maximum amount of time to wait with +-- the @timeout@ parameter. If @timeout@ is negative, the function +-- will wait indefinitely. +-- [_$_] +-- Messages not in @events@ will be popped off the bus and ignored. +-- [_$_] +-- Because 'busPoll' is implemented using the @"message"@ signal +-- enabled by 'busAddSignalWatch', calling 'busPoll' will cause the +-- @"message"@ signal to be emitted for every message that the +-- function sees. Thus, a @"message"@ signal handler will see every +-- message that 'busPoll' sees -- neither will steal messages from +-- the other. +-- [_$_] +-- This function will run a main loop in the default main context +-- while polling. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 443 +-- | Connect to the @"message"@ signal. Emitted from a 'Source' added +-- to the mainloop. This signal will only be emitted when there is a +-- 'MainLoop' running. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bus.chs 455 +-- | A message has been posted on the bus. This signal is emitted from +-- the thread that posted the message so one has to be careful with +-- locking. +-- [_$_] +-- This signal will not be emitted by default, you must first call +-- 'busUseSyncSignalHandler' if you want this signal to be emitted +-- when a message is posted on the bus. +onBusSyncMessage, afterBusSyncMessage :: BusClass bus + => bus + -> (Message -> IO ()) + -> IO (ConnectId bus) +onBusSyncMessage = + connect_BOXED__NONE "sync-message" peekMiniObject False +afterBusSyncMessage = + connect_BOXED__NONE "sync-message" peekMiniObject True + hunk ./gstreamer/Media/Streaming/GStreamer/Core/Types.chs 75 + BusSyncHandler, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Types.chs 335 +type BusSyncHandler = Bus + -> Message + -> IO BusSyncReply |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:53
|
Fri Nov 9 20:25:15 PST 2007 Peter Gavin <pg...@gm...> * glib: S.G.MainLoop: remove g_ prefix in some {#call#} tags for consistency (and to fix build error) hunk ./glib/System/Glib/MainLoop.chs.pp 121 -timeoutRemove id = {#call g_source_remove#} id >> return () +timeoutRemove id = {#call source_remove#} id >> return () hunk ./glib/System/Glib/MainLoop.chs.pp 133 - {#call unsafe g_idle_add_full#} (fromIntegral pri) funPtr + {#call unsafe idle_add_full#} (fromIntegral pri) funPtr hunk ./glib/System/Glib/MainLoop.chs.pp 139 -idleRemove id = {#call g_source_remove#} id >> return () +idleRemove id = {#call source_remove#} id >> return () hunk ./glib/System/Glib/MainLoop.chs.pp 191 -inputRemove id = {#call g_source_remove#} id >> return () +inputRemove id = {#call source_remove#} id >> return () |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:53
|
Fri Nov 9 20:17:37 PST 2007 Peter Gavin <pg...@gm...> * glib: S.G.MainLoop: new API: sourceRemove hunk ./glib/System/Glib/MainLoop.chs.pp 342 +sourceRemove :: Word + -> IO Bool +sourceRemove tag = + liftM toBool $ {# call source_remove #} $ fromIntegral tag + |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:53
|
Fri Nov 9 20:21:28 PST 2007 Peter Gavin <pg...@gm...> * glib: change Word to HandlerId in a few places hunk ./glib/System/Glib/MainLoop.chs.pp 302 - -> Word + -> HandlerId hunk ./glib/System/Glib/MainLoop.chs.pp 317 - -> IO Word + -> IO HandlerId hunk ./glib/System/Glib/MainLoop.chs.pp 342 -sourceRemove :: Word +sourceRemove :: HandlerId |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:53
|
Fri Nov 9 20:04:50 PST 2007 Peter Gavin <pg...@gm...> * glib: S.G.MainLoop: new API: mainContextFindSourceById, sourceDestroy, sourceIsDestroyed hunk ./glib/System/Glib/MainLoop.chs.pp 52 + mainContextFindSourceById, hunk ./glib/System/Glib/MainLoop.chs.pp 56 - sourceGetPriority + sourceGetPriority, + sourceDestroy, + sourceIsDestroyed hunk ./glib/System/Glib/MainLoop.chs.pp 301 +mainContextFindSourceById :: MainContext + -> Word + -> IO Source +mainContextFindSourceById context id = + {# call main_context_find_source_by_id #} context (fromIntegral id) >>= newSource . castPtr + hunk ./glib/System/Glib/MainLoop.chs.pp 332 +sourceDestroy :: Source + -> IO () +sourceDestroy source = + {# call source_destroy #} source + +sourceIsDestroyed :: Source + -> IO Bool +sourceIsDestroyed source = + liftM toBool $ {# call source_is_destroyed #} source |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:49
|
Thu Nov 8 16:11:45 PST 2007 Peter Gavin <pg...@gm...> * gstreamer: M.S.G.Core.Types code cleanups hunk ./gstreamer/Media/Streaming/GStreamer/Core/Types.chs 156 -import Data.Bits ( shiftL - , bit - , (.|.) ) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Types.chs 253 - liftM (toFlags . fromIntegral) $ + liftM cToFlags $ hunk ./gstreamer/Media/Streaming/GStreamer/Core/Types.chs 489 - toFlags $ fromIntegral $ unsafePerformIO $ + cToFlags $ unsafePerformIO $ hunk ./gstreamer/Media/Streaming/GStreamer/Core/Types.chs 745 - (toFlags $ fromIntegral flags) + (cToFlags flags) |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:48
|
Wed Nov 7 19:49:49 PST 2007 Peter Gavin <pg...@gm...> * gnomevfs: use c2hs {#enum#} for FilePermissions instead of hand coding it hunk ./gnomevfs/System/Gnome/VFS/Types.chs 239 -data FilePermissions = PermSUID -- ^ the set-user-ID bit - | PermSGID -- ^ the set-group-ID bit - | PermSticky -- ^ the \"sticky\" bit - | PermUserRead -- ^ owner read permission - | PermUserWrite -- ^ owner write permission - | PermUserExec -- ^ owner execute permission - | PermUserAll -- ^ equivalent to - -- @['PermUserRead', 'PermUserWrite', 'PermUserExec']@ - | PermGroupRead -- ^ group read permission - | PermGroupWrite -- ^ group write permission - | PermGroupExec -- ^ group execute permission - | PermGroupAll -- ^ equivalent to - -- @['PermGroupRead', 'PermGroupWrite', 'PermGroupExec']@ - | PermOtherRead -- ^ world read permission - | PermOtherWrite -- ^ world write permission - | PermOtherExec -- ^ world execute permission - | PermOtherAll -- ^ equivalent to - -- @['PermOtherRead', 'PermOtherWrite', 'PermOtherExec']@ - | PermAccessReadable -- ^ readable by the current process - | PermAccessWritable -- ^ writable by the current process - | PermAccessExecutable -- ^ executable by the current process - deriving (Eq, Bounded, Show) +{# enum GnomeVFSFilePermissions as FilePermissions { + GNOME_VFS_PERM_SUID as PermSUID, + GNOME_VFS_PERM_SGID as PermSGID, + GNOME_VFS_PERM_STICKY as PermSticky, + GNOME_VFS_PERM_USER_READ as PermUserRead, + GNOME_VFS_PERM_USER_WRITE as PermUserWrite, + GNOME_VFS_PERM_USER_EXEC as PermUserExec, + GNOME_VFS_PERM_USER_ALL as PermUserAll, + GNOME_VFS_PERM_GROUP_READ as PermGroupRead, + GNOME_VFS_PERM_GROUP_WRITE as PermGroupWrite, + GNOME_VFS_PERM_GROUP_EXEC as PermGroupExec, + GNOME_VFS_PERM_GROUP_ALL as PermGroupAll, + GNOME_VFS_PERM_OTHER_READ as PermOtherRead, + GNOME_VFS_PERM_OTHER_WRITE as PermOtherWrite, + GNOME_VFS_PERM_OTHER_EXEC as PermOtherExec, + GNOME_VFS_PERM_OTHER_ALL as PermOtherAll, + GNOME_VFS_PERM_ACCESS_READABLE as PermAccessReadable, + GNOME_VFS_PERM_ACCESS_WRITABLE as PermAccessWritable, + GNOME_VFS_PERM_ACCESS_EXECUTABLE as PermAccessExecutable + } deriving (Eq, Bounded, Show) #} hunk ./gnomevfs/System/Gnome/VFS/Types.chs 260 -instance Enum FilePermissions where - fromEnum PermSUID = 2048 - fromEnum PermSGID = 1024 - fromEnum PermSticky = 512 - fromEnum PermUserRead = 256 - fromEnum PermUserWrite = 128 - fromEnum PermUserExec = 64 - fromEnum PermUserAll = 448 - fromEnum PermGroupRead = 32 - fromEnum PermGroupWrite = 16 - fromEnum PermGroupExec = 8 - fromEnum PermGroupAll = 56 - fromEnum PermOtherRead = 4 - fromEnum PermOtherWrite = 2 - fromEnum PermOtherExec = 1 - fromEnum PermOtherAll = 7 - fromEnum PermAccessReadable = 65536 - fromEnum PermAccessWritable = 131072 - fromEnum PermAccessExecutable = 262144 - [_$_] - toEnum 2048 = PermSUID - toEnum 1024 = PermSGID - toEnum 512 = PermSticky - toEnum 256 = PermUserRead - toEnum 128 = PermUserWrite - toEnum 64 = PermUserExec - toEnum 448 = PermUserAll - toEnum 32 = PermGroupRead - toEnum 16 = PermGroupWrite - toEnum 8 = PermGroupExec - toEnum 56 = PermGroupAll - toEnum 4 = PermOtherRead - toEnum 2 = PermOtherWrite - toEnum 1 = PermOtherExec - toEnum 7 = PermOtherAll - toEnum 65536 = PermAccessReadable - toEnum 131072 = PermAccessWritable - toEnum 262144 = PermAccessExecutable - [_$_] - toEnum unmatched = error ("FilePermissions.toEnum: Cannot match " ++ show unmatched) |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:45
|
Sat Nov 3 06:55:04 PDT 2007 Peter Gavin <pg...@gm...> * gstreamer: M.S.G.Core.Buffer: add documentation, API improvements hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 29 +-- +-- Data-passing buffer type, supporting sub-buffers. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 33 +-- * Types + + -- | Buffers are the basic unit of data transfer in GStreamer. The + -- 'Buffer' type provides all the state necessary to define a + -- region of memory as part of a stream. Sub-buffers are also + -- supported, allowing a smaller region of a buffer to become its + -- own buffer, with mechansims in place to ensure that neither + -- memory space goes away prematurely. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 44 - toBuffer, + -- Safely downcast an 'Object' to a 'Bin'. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 46 + -- Upcast to a 'Bin'. + toBuffer, + -- See if an 'Object' is a 'Bin'. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 50 + +-- * Buffer Operations hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 62 + unsafeBufferGetPtrM, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 78 - bufferDurationIsValid, - bufferDurationIsValidM, - bufferTimestampIsValid, - bufferTimestampIsValidM, - bufferOffsetIsValid, - bufferOffsetIsValidM, - bufferOffsetEndIsValid, - bufferOffsetEndIsValidM, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 87 - bufferStampM, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 104 - +-- | Get the flags set on this buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 110 +-- | Get the flags set on the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 115 +-- | Set flags on the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 121 +-- | Unset flags on the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 127 +-- | Get the size of the buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 141 +-- | Get the size of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 148 +-- | Make an O(n) copy of the buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 162 +-- | Make an O(n) copy of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 175 +-- | Store an O(n) copy of the provided data in the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 191 +-- | Get a raw pointer to the internal data area for the current +-- buffer. The pointer may be used to write into the data area if +-- desired. This function is unsafe in that the pointer should not +-- be used once the buffer is returned. +unsafeBufferGetPtrM :: BufferClass bufferT + => MiniObjectM bufferT (Ptr Word8) +unsafeBufferGetPtrM = + MiniObjectM $ \buffer -> + liftM castPtr $ + withMiniObject buffer $ + {# get GstBuffer->data #} . castPtr + +marshalGetNum :: (BufferClass bufferT, Integral intT, Num numT) + => (Ptr Buffer -> IO intT) + -> numT + -> bufferT + -> Maybe numT +marshalGetNum getAction invalid buffer = + let n = fromIntegral $ unsafePerformIO $ + withMiniObject (toBuffer buffer) getAction + in if n /= invalid + then Just n + else Nothing + +marshalGetNumM :: (BufferClass bufferT, Integral intT, Num numT) + => (Ptr Buffer -> IO intT) + -> numT + -> MiniObjectM bufferT (Maybe numT) +marshalGetNumM getAction invalid = + marshalBufferM $ \bufferPtr -> do + n <- liftM fromIntegral $ getAction bufferPtr + return $ if n /= invalid + then Just n + else Nothing + +marshalSetNumM :: (BufferClass bufferT, Integral intT, Num numT) + => (Ptr Buffer -> numT -> IO ()) + -> intT + -> Maybe intT + -> MiniObjectM bufferT () +marshalSetNumM setAction invalid nM = + let n = case nM of + Just n' -> n' + Nothing -> invalid + in marshalBufferM $ flip setAction $ fromIntegral n + +-- | Get the timestamp for this buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 240 - -> ClockTime -bufferGetTimestamp buffer = - fromIntegral $ unsafePerformIO $ - withMiniObject buffer {# get GstBuffer->timestamp #} + -> Maybe ClockTime +bufferGetTimestamp = + marshalGetNum {# get GstBuffer->timestamp #} clockTimeNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 244 +-- | Get the timestamp of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 246 - => MiniObjectM bufferT ClockTime + => MiniObjectM bufferT (Maybe ClockTime) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 248 - liftM fromIntegral $ - marshalBufferM {# get GstBuffer->timestamp #} + marshalGetNumM {# get GstBuffer->timestamp #} clockTimeNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 250 +-- | Set the timestamp of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 252 - => ClockTime + => Maybe ClockTime hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 254 -bufferSetTimestampM timestamp = - marshalBufferM $ flip {# set GstBuffer->timestamp #} $ fromIntegral timestamp +bufferSetTimestampM = + marshalSetNumM {# set GstBuffer->timestamp #} clockTimeNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 257 +-- | Get the duration of the buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 260 - -> ClockTime -bufferGetDuration buffer = - fromIntegral $ unsafePerformIO $ - withMiniObject buffer {# get GstBuffer->duration #} + -> Maybe ClockTime +bufferGetDuration = + marshalGetNum {# get GstBuffer->duration #} clockTimeNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 264 +-- | Get the duration of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 266 - => MiniObjectM bufferT ClockTime + => MiniObjectM bufferT (Maybe ClockTime) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 268 - liftM fromIntegral $ - marshalBufferM {# get GstBuffer->duration #} + marshalGetNumM {# get GstBuffer->duration #} clockTimeNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 270 +-- | Set the duration of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 272 - => ClockTime + => Maybe ClockTime hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 274 -bufferSetDurationM duration = - marshalBufferM $ - flip {# set GstBuffer->duration #} $ fromIntegral duration +bufferSetDurationM = + marshalSetNumM {# set GstBuffer->duration #} clockTimeNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 277 +-- | Get the caps of the buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 286 +-- | Get the caps of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 294 +-- | Set the caps of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 296 - => Caps + => Maybe Caps hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 298 -bufferSetCapsM caps = +bufferSetCapsM capsM = hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 300 - {# call buffer_set_caps #} (toBuffer buffer) caps + {# call buffer_set_caps #} (toBuffer buffer) $ + case capsM of + Just caps -> caps + Nothing -> Caps nullForeignPtr hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 305 +-- | Get the offset of the buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 308 - -> Word64 -bufferGetOffset buffer = - fromIntegral $ unsafePerformIO $ - withMiniObject buffer {# get GstBuffer->offset #} + -> Maybe Word64 +bufferGetOffset = + marshalGetNum {# get GstBuffer->offset #} bufferOffsetNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 312 +-- | Get the start offset of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 314 - => MiniObjectM bufferT Word64 + => MiniObjectM bufferT (Maybe Word64) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 316 - liftM fromIntegral $ - marshalBufferM {# get GstBuffer->offset #} + marshalGetNumM {# get GstBuffer->offset #} bufferOffsetNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 318 +-- | Set the start offset of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 320 - => Word64 + => Maybe Word64 hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 322 -bufferSetOffsetM offset = - marshalBufferM $ - flip {# set GstBuffer->offset #} $ fromIntegral offset +bufferSetOffsetM = + marshalSetNumM {# set GstBuffer->offset #} bufferOffsetNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 325 +-- | Get the end offset of the buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 328 - -> Word64 -bufferGetOffsetEnd buffer = - fromIntegral $ unsafePerformIO $ - withMiniObject buffer {# get GstBuffer->offset_end #} + -> Maybe Word64 +bufferGetOffsetEnd = + marshalGetNum {# get GstBuffer->offset_end #} bufferOffsetNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 332 +-- | Get the end offset of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 334 - => MiniObjectM bufferT Word64 + => MiniObjectM bufferT (Maybe Word64) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 336 - liftM fromIntegral $ - marshalBufferM {# get GstBuffer->offset_end #} + marshalGetNumM {# get GstBuffer->offset_end #} bufferOffsetNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 338 +-- | Set the end offset of the current buffer. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 340 - => Word64 + => Maybe Word64 hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 342 -bufferSetOffsetEndM offsetEnd = - marshalBufferM $ - flip {# set GstBuffer->offset_end #} $ fromIntegral offsetEnd - -bufferDurationIsValid :: BufferClass bufferT - => bufferT - -> Bool -bufferDurationIsValid = - (/= clockTimeNone) . bufferGetOffset - -bufferDurationIsValidM :: BufferClass bufferT - => MiniObjectM bufferT Bool -bufferDurationIsValidM = - liftM (/= clockTimeNone) $ bufferGetDurationM - -bufferTimestampIsValid :: BufferClass bufferT - => bufferT - -> Bool -bufferTimestampIsValid = - (/= clockTimeNone) . bufferGetTimestamp - -bufferTimestampIsValidM :: BufferClass bufferT - => MiniObjectM bufferT Bool -bufferTimestampIsValidM = - liftM (/= clockTimeNone) $ bufferGetTimestampM - -bufferOffsetIsValid :: BufferClass bufferT - => bufferT - -> Bool -bufferOffsetIsValid = - (/= bufferOffsetNone) . bufferGetOffset - -bufferOffsetIsValidM :: BufferClass bufferT - => MiniObjectM bufferT Bool -bufferOffsetIsValidM = - liftM (/= bufferOffsetNone) $ bufferGetOffsetM - -bufferOffsetEndIsValid :: BufferClass bufferT - => bufferT - -> Bool -bufferOffsetEndIsValid = - (/= bufferOffsetNone) . bufferGetOffsetEnd - -bufferOffsetEndIsValidM :: BufferClass bufferT - => MiniObjectM bufferT Bool -bufferOffsetEndIsValidM = - liftM (/= bufferOffsetNone) $ bufferGetOffsetEndM +bufferSetOffsetEndM = + marshalSetNumM {# set GstBuffer->offset_end #} bufferOffsetNone hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 345 +-- | Return 'True' if the buffer marks a discontinuity in a stream, or +-- 'False' otherwise. This typically occurs after a seek or a +-- dropped buffer from a live or network source. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 354 +-- | Return 'True' if the current buffer marks a discontinuity in a +-- stream, or 'False' otherwise. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 361 -bufferCreateEmpty :: MiniObjectM Buffer a - -> IO (Buffer, a) +-- | Create an empty buffer and mutates it according to the given +-- action. Once this function returns, the buffer is immutable. +bufferCreateEmpty :: MiniObjectM Buffer a -- ^ the mutating action + -> IO (Buffer, a) -- ^ the new buffer and the action's result hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 368 -bufferCreate :: Word - -> MiniObjectM Buffer a - -> IO (Buffer, a) +-- | Create and mutate a buffer of the given size. +bufferCreate :: Word -- ^ the size of the buffer to be created + -> MiniObjectM Buffer a -- ^ the mutating action + -> IO (Buffer, a) -- ^ the new buffer and the action's result hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 376 +-- | Create a sub-buffer from an existing buffer with the given offset +-- and size. This sub-buffer uses the actual memory space of the +-- parent buffer. Thus function will copy the offset and timestamp +-- fields when the offset is 0. Otherwise, they will both be set to +-- 'Nothing'. If the offset is 0 and the size is the total size of +-- the parent, the duration and offset end fields are also +-- copied. Otherwise they will be set to 'Nothing'. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 384 - => bufferT - -> Word - -> Word - -> MiniObjectM Buffer a - -> IO (Buffer, a) + => bufferT -- ^ the parent buffer + -> Word -- ^ the offset + -> Word -- ^ the size + -> IO (Maybe Buffer) -- ^ the new sub-buffer hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 389 - marshalMiniObjectModify $ - {# call buffer_create_sub #} (toBuffer parent) - (fromIntegral offset) - (fromIntegral size) + {# call buffer_create_sub #} (toBuffer parent) + (fromIntegral offset) + (fromIntegral size) >>= + maybePeek takeMiniObject hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 394 +-- | Return 'True' if 'bufferSpan' can be done without copying the +-- data, or 'False' otherwise. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 405 +-- | Create a new buffer that consists of a span across the given +-- buffers. Logically, the buffers are concatenated to make a larger +-- buffer, and a new buffer is created at the given offset and with +-- the given size. +-- [_$_] +-- If the two buffers are children of the same larger buffer, and +-- are contiguous, no copying is necessary. You can use +-- 'bufferIsSpanFast' to determine if copying is needed. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 414 - => bufferT1 - -> Word32 - -> bufferT2 - -> Word32 - -> Maybe Buffer + => bufferT1 -- ^ the first buffer + -> Word32 -- ^ the offset into the concatenated buffer + -> bufferT2 -- ^ the second buffer + -> Word32 -- ^ the length of the final buffer + -> Maybe Buffer -- ^ the spanning buffer, or 'Nothing' if + -- the arguments are invalid hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 428 -bufferStampM :: (BufferClass srcT, BufferClass destT) - => srcT - -> MiniObjectM destT () -bufferStampM src = - MiniObjectM $ \dest -> - {# call buffer_stamp #} (toBuffer dest) - (toBuffer src) - +-- | Concatenate two buffers. If the buffers point to contiguous memory +-- areas, no copying will occur. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 431 - => bufferT1 - -> bufferT2 - -> Buffer + => bufferT1 -- ^ a buffer + -> bufferT2 -- ^ a buffer + -> Buffer -- ^ the concatenation of the buffers |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:42
|
Thu Nov 1 17:31:42 PDT 2007 Peter Gavin <pg...@gm...> * gstreamer: document M.S.G.Core.Constants; add version checks, remove MessageStateDirty (deprecated) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 25 --- [_$_] + +-- #hide + [_$_] hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 32 - [_$_] hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 33 - [_$_] hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 38 - [_$_] + BufferOffset, + bufferOffsetNone, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 49 - bufferOffsetNone, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 52 - [_$_] hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 57 +-- | A time value in nanoseconds. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 60 +-- | The undefined 'ClockTime' value. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 65 +-- | One second as a 'ClockTime' value. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 67 +-- | One millisecond as a 'ClockTime' value. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 69 +-- | One microsecond as a 'ClockTime' value. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 71 +-- | One nanosecond as a 'ClockTime' value. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 74 -data ObjectFlags = ObjectDisposing +-- | The type for buffer offsets. +type BufferOffset = Word64 +-- | The undefined 'BufferOffset' value. +bufferOffsetNone :: BufferOffset +bufferOffsetNone = #{const GST_BUFFER_OFFSET_NONE} + +-- | The flags that an 'Object' may have. +data ObjectFlags = ObjectDisposing -- ^ The object has been + -- destroyed, don't use it any + -- more. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 90 -data PadFlags = PadBlocked - | PadFlushing - | PadInGetCaps - | PadInSetCaps - | PadBlocking +-- | The flags that a 'Pad' may have. +data PadFlags = PadBlocked -- ^ dataflow on the pad is blocked + | PadFlushing -- ^ the pad is refusing buffers + | PadInGetCaps -- ^ 'padGetCaps' is executing + | PadInSetCaps -- ^ 'padSetCaps' is executing + | PadBlocking -- ^ the pad is blocking on a buffer or event hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 110 -data ElementFlags = ElementLockedState - | ElementIsSink - | ElementUnparenting +-- | The flags that an 'Element' may have. +data ElementFlags = ElementLockedState -- ^ parent state changes are ignored + | ElementIsSink -- ^ the element is a sink + | ElementUnparenting -- ^ child is being removed + -- from the parent bin hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 125 -data StateChange = StateChangeNullToReady - | StateChangeReadyToPaused - | StateChangePausedToPlaying - | StateChangePlayingToPaused - | StateChangePausedToReady - | StateChangeReadyToNull +-- | The different state changes that are passed to the state change +-- functions of 'Element's. +data StateChange = StateChangeNullToReady -- ^ state change from 'StateNull' to 'StateReady' + | StateChangeReadyToPaused -- ^ state change from 'StateReady' to 'StatePaused' + | StateChangePausedToPlaying -- ^ state change from 'StatePaused' to 'StatePlaying' + | StateChangePlayingToPaused -- ^ state change from 'StatePlaying' to 'StatePaused' + | StateChangePausedToReady -- ^ state change from 'StatePaused' to 'StateReady' + | StateChangeReadyToNull -- ^ state change from 'StateReady' to 'StateNull' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 149 -data BusFlags = BusFlushing +-- | The flags that a 'Bus' may have. +data BusFlags = BusFlushing -- ^ the bus is currently dropping all messages hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 157 -data ClockFlags = ClockCanDoSingleSync - | ClockCanDoSingleAsync - | ClockCanDoPeriodicSync - | ClockCanDoPeriodicAsync - | ClockCanSetResolution - | ClockCanSetMaster +-- | The flags that a 'Clock' may have. +data ClockFlags = ClockCanDoSingleSync -- ^ the clock can do a single sync timeout request + | ClockCanDoSingleAsync -- ^ the clock can do a single async timeout request + | ClockCanDoPeriodicSync -- ^ the clock can do periodic sync timeout requests + | ClockCanDoPeriodicAsync -- ^ the clock can do periodic async timeout requests + | ClockCanSetResolution -- ^ the clock's resolution can be changed + | ClockCanSetMaster -- ^ the clock can be slaved to a master clock hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 181 -data IndexFlags = IndexWritable - | IndexReadable +-- | The flags an 'Index' may have. +data IndexFlags = IndexWritable -- ^ the index is writable + | IndexReadable -- ^ the index is readable hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 192 -data MiniObjectFlags = MiniObjectReadOnly +-- | The flags a 'MiniObject' may have. +data MiniObjectFlags = MiniObjectReadOnly -- ^ the object is not writable hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 200 -data BufferFlags = BufferPreroll - | BufferDiscont - | BufferInCaps - | BufferGap - | BufferDeltaUnit +-- | The flags a 'Buffer' may have. +data BufferFlags = BufferPreroll -- ^ the buffer is part of a preroll and should not be displayed + | BufferDiscont -- ^ the buffer marks a discontinuity in the stream + | BufferInCaps -- ^ the buffer has been added as a field in a 'Caps' + | BufferGap -- ^ the buffer has been created to fill a gap in the stream + | BufferDeltaUnit -- ^ the buffer cannot be decoded independently hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 220 -bufferOffsetNone :: Word64 -bufferOffsetNone = #{const GST_BUFFER_OFFSET_NONE} - -data EventType = EventUnknown - | EventFlushStart - | EventFlushStop - | EventEOS - | EventNewSegment - | EventTag - | EventBufferSize - | EventQOS - | EventSeek - | EventNavigation - | EventLatency - | EventCustomUpstream - | EventCustomDownstream - | EventCustomDownstreamOOB - | EventCustomBoth - | EventCustomBothOOB +-- | The event types that may occur in a pipeline. +data EventType = EventUnknown -- ^ an unknown event + | EventFlushStart -- ^ start a flush operation + | EventFlushStop -- ^ stop a flush operation + | EventEOS -- ^ end of stream + | EventNewSegment -- ^ a new segment follows in the dataflow + | EventTag -- ^ a new set of metadata tags has been found + | EventBufferSize -- ^ notification of buffering requirements + | EventQOS -- ^ quality of service notification + | EventSeek -- ^ a request for a new playback position and rate + | EventNavigation -- ^ notification of user request +#if GSTREAMER_CHECK_VERSION(0, 10, 12) + | EventLatency -- ^ notification of latency adjustment +#endif + | EventCustomUpstream -- ^ custom upstream event + | EventCustomDownstream -- ^ custom downstream event + | EventCustomDownstreamOOB -- ^ custom downstream out-of-band event + | EventCustomBoth -- ^ custom bidirectional event + | EventCustomBothOOB -- ^ custom bidirectional out-of-band event hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 251 +#if GSTREAMER_CHECK_VERSION(0, 10, 12) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 253 +#endif hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 270 +#if GSTREAMER_CHECK_VERSION(0, 10, 12) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 272 +#endif hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 279 -data MessageType = MessageEOS - | MessageError - | MessageWarning - | MessageInfo - | MessageTag - | MessageBuffering - | MessageStateChanged - | MessageStateDirty - | MessageStepDone - | MessageClockProvide - | MessageClockLost - | MessageNewClock - | MessageStructureChange - | MessageStreamStatus - | MessageApplication - | MessageElement - | MessageSegmentStart - | MessageSegmentDone - | MessageDuration - | MessageLatency - | MessageAsyncStart +-- | The messages types that may be sent by a pipeline. +data MessageType = MessageEOS -- ^ end-of-stream + | MessageError -- ^ an error message + | MessageWarning -- ^ a warning message + | MessageInfo -- ^ an informational message + | MessageTag -- ^ a metadata tag + | MessageBuffering -- ^ the pipeline is buffering + | MessageStateChanged -- ^ the pipeline changed state + | MessageStepDone -- ^ a framestep finished + | MessageClockProvide -- ^ an element is able to provide a clock + | MessageClockLost -- ^ the current clock has become unusable + | MessageNewClock -- ^ a new clock was selected by the pipeline + | MessageStructureChange -- ^ the structure of the pipeline has changed + | MessageStreamStatus -- ^ a stream status message + | MessageApplication -- ^ a message posted by the application + | MessageElement -- ^ an element specific message + | MessageSegmentStart -- ^ the pipeline started playback of a segment + | MessageSegmentDone -- ^ the pipeline finished playback of a segment + | MessageDuration -- ^ the duration of the pipeline changed +#if GSTREAMER_CHECK_VERSION(0, 10, 12) + | MessageLatency -- ^ an element's latency has changed +#endif +#if GSTREAMER_CHECK_VERSION(0, 10, 13) + | MessageAsyncStart -- ^ [_$_] hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 304 +#endif hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 314 - | n == #{const GST_MESSAGE_STATE_DIRTY} = MessageStateDirty hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 335 - fromEnum MessageStateDirty = #{const GST_MESSAGE_STATE_DIRTY} hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 351 +-- | The flags that a 'Caps' may have. |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:39
|
Wed Oct 31 13:01:39 PDT 2007 Peter Gavin <pg...@gm...> * gstreamer: add docs & fix formatting in M/S/G/Core/Bin.chs; rename to Bin.chs.pp move ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp hunk ./Makefile.am 1904 - gstreamer/Media/Streaming/GStreamer/Core/Bin.chs \ + gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp \ hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 29 +-- [_$_] +-- Base class for elements that can contain other elements. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 32 - [_$_] + +-- * Types + + -- | 'Bin' is an element that can contain other 'Element's, allowing + -- them to be managed as a group. 'Pad's from the child elements + -- can be ghosted to the bin; see 'GhostPad'. This makes the bin + -- look like any other element, and enables creation of + -- higher-level abstractions. + -- [_$_] + -- A new 'Bin' is created with 'binNew'. Use a 'Pipeline' instead + -- if you want to create a toplevel bin, because a normal bin + -- doesn't have a bus or handle clock distribution of its own. + -- [_$_] + -- After the bin has been created you will typically add elements + -- to it with 'binAdd'. You can remove elements with 'binRemove'. + -- [_$_] + -- An element can be retrieved from a bin with 'binGetByName', + -- using the element's name. 'binGetByNameRecurseUp' is mainly + -- used for internal purposes and will query the parent bins when + -- the element is not found in the current bin. + -- [_$_] + -- An iterator of elements in a bin can be retrieved with + -- 'binIterateElements'. Various other iterators exist to retrieve + -- the elements in a bin. + -- [_$_] + -- The 'onBinElementAdded' signal is fired whenever a new element is + -- added to the bin. Likewise the 'onBinElementRemoved' signal is + -- fired whenever an element is removed from the bin. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 62 + -- Safely downcast an 'Object' to a 'Bin'. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 64 + -- Upcast to a 'Bin'. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 66 + -- See if an 'Object' is a 'Bin'. + isBin, + +-- * Bin Operations + binNew, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 84 +-- * Bin Signals hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 104 -binAdd :: (BinClass bin, - ElementClass element) => - bin - -> element - -> IO Bool +-- | Creates a new 'Bin' with the given name. +binNew :: String -- ^ the name of the new bin + -> IO Bin -- ^ the new bin +binNew name = + withUTFString name {# call bin_new #} >>= takeObject . castPtr + +-- | Adds the given 'Element' to the 'Bin'. Sets the element's parent. An +-- element can only be added to one bin. +-- [_$_] +-- If the element's pads are linked to other pads, the pads will be +-- unlinked before the element is added to the bin. +binAdd :: (BinClass bin, ElementClass element) + => bin -- ^ a bin + -> element -- ^ the element to be added + -> IO Bool -- ^ 'True' if the element could be added, 'False' + -- if the bin does not want to accept the element hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 123 -binRemove :: (BinClass bin, - ElementClass element) => - bin - -> element - -> IO Bool +-- | Removes the given 'Element' from the 'Bin', unparenting it as well. +-- [_$_] +-- If the element's pads are linked to other pads, the pads will be +-- unlinked before the element is removed from the bin. +binRemove :: (BinClass bin, ElementClass element) + => bin -- ^ a bin + -> element -- ^ the element to remove + -> IO Bool -- ^ 'True' if the element could be removed, 'False' + -- if the bin does not want to remove the element hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 135 -binGetByName :: BinClass bin => - bin - -> String - -> IO (Maybe Element) +-- | Gets the 'Element' with the given name from a 'Bin'. This +-- function recurses into child bins. Returns 'Nothing' if no element +-- with the given name is found in the bin. +binGetByName :: BinClass bin + => bin -- ^ a bin + -> String -- ^ the element name to search for + -> IO (Maybe Element) -- ^ the element with the given name, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 145 -binGetByNameRecurseUp :: BinClass bin => - bin - -> String - -> IO (Maybe Element) +-- | Gets the element with the given name from this bin. If the +-- element is not found, a recursion is performed on the parent +-- bin. Returns 'Nothing' if no element with the given name is +-- found. +binGetByNameRecurseUp :: BinClass bin + => bin -- ^ a bin + -> String -- ^ the element name to search for + -> IO (Maybe Element) -- ^ the element with the given name, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 157 -binGetByInterface :: BinClass bin => - bin - -> GType - -> IO (Maybe Element) +-- | Looks for an element inside the bin that implements the given +-- interface. If such an element is found, it returns the +-- element. You can case this element to the given interface +-- afterwards. If you want all the elements that implement an +-- interface, use 'binIterateAllByInterface'. +-- [_$_] +-- This function recurses into child bins. +binGetByInterface :: BinClass bin + => bin -- ^ a bin + -> GType -- ^ the interface's type + -> IO (Maybe Element) -- ^ an element inside the bin implementing the interface, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 172 -binIterateElements :: BinClass bin => - bin - -> IO (Maybe (Iterator Element)) +-- | Gets an 'Iterator' for the 'Element's in this 'Bin'. +binIterateElements :: BinClass bin + => bin -- ^ a bin + -> IO (Maybe (Iterator Element)) -- ^ an iterator on elements, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 180 -binIterateRecurse :: BinClass bin => - bin - -> IO (Maybe (Iterator Element)) +-- | Gets an 'Iterator' for the 'Element's in this 'Bin'. This +-- iterator recurses into the bin's children. +binIterateRecurse :: BinClass bin + => bin -- ^ a bin + -> IO (Maybe (Iterator Element)) -- ^ an iterator on elements, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 189 -binIterateSinks :: BinClass bin => - bin - -> IO (Maybe (Iterator Element)) +-- | Gets an iterator for all elements in the bin that have the +-- 'ElementIsSink' flag set. +binIterateSinks :: BinClass bin + => bin -- ^ a bin + -> IO (Maybe (Iterator Element)) -- ^ an iterator on elements, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 198 -binIterateSorted :: BinClass bin => - bin - -> IO (Maybe (Iterator Element)) +-- | Gets an iterator for the elements in this bin in topologically +-- sorted order. This means that the elements are returned from the +-- most downstream elements (sinks) to the sources. +-- [_$_] +-- This function is used internally to perform state changes of the +-- bin elements. +binIterateSorted :: BinClass bin + => bin -- ^ a bin + -> IO (Maybe (Iterator Element)) -- ^ an iterator on elements, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 211 -binIterateSources :: BinClass bin => - bin - -> IO (Maybe (Iterator Element)) +-- | Gets an iterator for all elements in the bin that have no sink +-- pads and have the 'ElementIsSink' flag unset. +binIterateSources :: BinClass bin + => bin -- ^ a bin + -> IO (Maybe (Iterator Element)) -- ^ an iterator on elements, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 220 -binIterateAllByInterface :: BinClass bin => - bin - -> GType - -> IO (Maybe (Iterator Element)) +-- | Looks for all elements inside the bin that implement the given +-- interface. You can safely case all elements to the given +-- interface. The function recurses inside child bins. +binIterateAllByInterface :: BinClass bin + => bin -- ^ a bin + -> GType -- ^ the interface's type + -> IO (Maybe (Iterator Element)) -- ^ an iterator on elements, or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 231 -binFindUnconnectedPad :: BinClass bin => - bin - -> PadDirection - -> IO (Maybe Pad) +#if GSTREAMER_CHECK_VERSION (0, 10, 3) +-- | Recursively looks for elements with an unconnected pad of the +-- given direction within the specified bin. Returns an unconnected +-- pad if one is found, otherwise 'Nothing'. +binFindUnconnectedPad :: BinClass bin + => bin -- ^ a bin + -> PadDirection -- ^ whether to look for a source pad or a sink pad + -> IO (Maybe Pad) -- ^ an unconnected pad or 'Nothing' hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 242 +#endif + hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 245 +-- | Handle the signal emitted when an 'Element' is added to a 'Bin'. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 247 - => bin - -> (Element -> IO ()) - -> IO (ConnectId bin) + => bin -- ^ a bin + -> (Element -> IO ()) -- ^ the signal handler + -> IO (ConnectId bin) -- ^ the connection id hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 255 +-- | Handle the signal emitted when an 'Element' is removed from a 'Bin'. hunk ./gstreamer/Media/Streaming/GStreamer/Core/Bin.chs.pp 257 - => bin - -> (Element -> IO ()) - -> IO (ConnectId bin) + => bin -- ^ a bin + -> (Element -> IO ()) -- ^ the signal handler + -> IO (ConnectId bin) -- ^ the connection id |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:38
|
Mon Oct 29 17:11:37 PDT 2007 Peter Gavin <pg...@gm...> * gstreamer: move M.S.G.Core.Buffer.bufferOffsetNone to M.S.G.Core.Constants and use #{const ...} hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 97 -bufferOffsetNone :: Word64 -bufferOffsetNone = maxBound -- should be ((guint64) -1) hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 48 + bufferOffsetNone, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Constants.hsc 196 +bufferOffsetNone :: Word64 +bufferOffsetNone = #{const GST_BUFFER_OFFSET_NONE} + |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:38
|
Mon Oct 29 15:25:29 PDT 2007 Peter Gavin <pg...@gm...> * configure.ac: add GSTREAMER_CHECK_VERSION macro hunk ./configure.ac 464 +dnl Also allow us to conditionally compile bindings to Glib APIs. +GSTREAMER_VERSION=`$PKG_CONFIG gstreamer-0.10 --modversion` +GSTREAMER_MAJOR_VERSION=`echo $GSTREAMER_VERSION | $CUT -d. -f1` +GSTREAMER_MINOR_VERSION=`echo $GSTREAMER_VERSION | $CUT -d. -f2` +GSTREAMER_MICRO_VERSION=`echo $GSTREAMER_VERSION | $CUT -d. -f3` +AC_DEFINE_UNQUOTED(_GSTREAMER_MAJOR_VERSION, ($GSTREAMER_MAJOR_VERSION), [Glib major version number]) +AC_DEFINE_UNQUOTED(_GSTREAMER_MINOR_VERSION, ($GSTREAMER_MINOR_VERSION), [Glib minor version number]) +AC_DEFINE_UNQUOTED(_GSTREAMER_MICRO_VERSION, ($GSTREAMER_MICRO_VERSION), [Glib minor patch level]) +AH_BOTTOM([ +/* Allow code to be compiled differently for different versions of Glib */ +#define GSTREAMER_CHECK_VERSION(major,minor,micro) \ + (_GSTREAMER_MAJOR_VERSION > (major) || \ + (_GSTREAMER_MAJOR_VERSION == (major) && _GSTREAMER_MINOR_VERSION > (minor)) || \ + (_GSTREAMER_MAJOR_VERSION == (major) && _GSTREAMER_MINOR_VERSION == (minor) && \ + _GSTREAMER_MICRO_VERSION >= (micro))) +]) + |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:37
|
Mon Oct 29 15:23:56 PDT 2007 Peter Gavin <pg...@gm...> * Makefile.am: filter CFLAGS/LDFLAGS for gstreamer & gnomevfs hunk ./configure.ac 577 +GTKHS_PACKAGE_FILTER_CFLAGS([GNOMEVFS_CFLAGS], [$GLIB_CFLAGS], [$GNOMEVFS_CFLAGS]) +GTKHS_PACKAGE_FILTER_LIBS([GNOMEVFS_LIBS], [$GLIB_LIBS], [$GNOMEVFS_LIBS]) + +GTKHS_PACKAGE_FILTER_CFLAGS([GSTREAMER_CFLAGS], [$GLIB_CFLAGS], [$GSTREAMER_CFLAGS]) +GTKHS_PACKAGE_FILTER_LIBS([GSTREAMER_LIBS], [$GLIB_LIBS], [$GSTREAMER_LIBS]) |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:34
|
Mon Oct 29 13:28:36 PDT 2007 Peter Gavin <pg...@gm...> * gstreamer: M.S.G.Core.Buffer/M.S.G.Base.Adapter: change ghc version check to OLD_BYTESTRING macro hunk ./gstreamer/Media/Streaming/GStreamer/Base/Adapter.chs.pp 50 +#if __GLASGOW_HASKELL__ >= 606 && __GLASGOW_HASKELL__ < 608 +#define OLD_BYTESTRING +#endif + hunk ./gstreamer/Media/Streaming/GStreamer/Base/Adapter.chs.pp 56 -#if __GLASGOW_HASKELL__ < 608 +#ifdef OLD_BYTESTRING hunk ./gstreamer/Media/Streaming/GStreamer/Base/Adapter.chs.pp 96 -#if __GLASGOW_HASKELL__ < 608 +#ifdef OLD_BYTESTRING hunk ./gstreamer/Media/Streaming/GStreamer/Base/Adapter.chs.pp 158 -#if __GLASGOW_HASKELL__ >= 608 +#ifndef OLD_BYTESTRING hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 91 +#if __GLASGOW_HASKELL__ >= 606 && __GLASGOW_HASKELL__ < 608 +#define OLD_BYTESTRING +#endif + hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 145 -#if __GLASGOW_HASKELL__ < 608 +#ifdef OLD_BYTESTRING hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 157 -#if __GLASGOW_HASKELL__ < 608 +#ifdef OLD_BYTESTRING |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:34
|
Thu Nov 8 14:08:33 PST 2007 Duncan Coutts <du...@ha...> * remove old ghc-6.2 package config files hunk ./cairo/cairo.pkg.in 1 -Package { - name = "cairo", - auto = True, - import_dirs = ["${pkglibdir}/imports/cairo"], - source_dirs = [], - library_dirs = [@CAIRO_LIBDIR_CQ@], - hs_libraries = ["HScairo"], - extra_libraries = [@CAIRO_LIBS_CQ@], - include_dirs = [@CAIRO_CFLAGS_CQ@], - c_includes = [@CAIRO_HEADERS@], - package_deps = ["base", "glib"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@CAIRO_LIBEXTRA_CQ@] -} rmfile ./cairo/cairo.pkg.in hunk ./gconf/gconf.pkg.in 1 -Package { - name = "gconf", - auto = True, - import_dirs = ["${pkglibdir}/imports/gconf"], - source_dirs = [], - library_dirs = [@GCONF_LIBDIR_CQ@], - hs_libraries = ["HSgconf"], - extra_libraries = [@GCONF_LIBS_CQ@], - include_dirs = [@GCONF_CFLAGS_CQ@], - c_includes = ["gconf/gconf-client.h"], - package_deps = ["base", "glib"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@GCONF_LIBEXTRA_CQ@] -} rmfile ./gconf/gconf.pkg.in hunk ./glade/glade.pkg.in 1 -Package { - name = "glade", - auto = True, - import_dirs = ["${pkglibdir}/imports/glade"], - source_dirs = [], - library_dirs = [@LIBGLADE_LIBDIR_CQ@], - hs_libraries = ["HSglade"], - extra_libraries = [@LIBGLADE_LIBS_CQ@], - include_dirs = [@LIBGLADE_CFLAGS_CQ@], - c_includes = ["glade/glade.h"], - package_deps = ["base", "gtk"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@LIBGLADE_LIBEXTRA_CQ@] -} rmfile ./glade/glade.pkg.in hunk ./glib/glib.pkg.in 1 -Package { - name = "glib", - auto = True, - import_dirs = ["${pkglibdir}/imports/glib"], - source_dirs = [], - library_dirs = [@GLIB_LIBDIR_CQ@], - hs_libraries = ["HSglib"], - extra_libraries = [@GLIB_LIBS_CQ@], - include_dirs = [@GLIB_CFLAGS_CQ@], - c_includes = ["glib.h", "glib-object.h"], - package_deps = ["base"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@GLIB_LIBEXTRA_CQ@] -} rmfile ./glib/glib.pkg.in hunk ./gnomevfs/gnomevfs.pkg.in 1 -Package { - name = "gnomevfs", - auto = True, - import_dirs = ["${pkglibdir}/imports/gnomevfs"], - source_dirs = [], - library_dirs = [@GNOMEVFS_LIBDIR_CQ@], - hs_libraries = ["HSgnomevfs"], - extra_libraries = [@GNOMEVFS_LIBS_CQ@], - include_dirs = [@GNOMEVFS_CFLAGS_CQ@], - c_includes = ["libgnomevfs/gnome-vfs.h", "libgnomevfs/gnome-vfs-mime.h"], - package_deps = ["glib"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@GNOMEVFS_LIBEXTRA_CQ@] -} rmfile ./gnomevfs/gnomevfs.pkg.in hunk ./gstreamer/gstreamer.pkg.in 1 -Package { - name = "gstreamer", - auto = True, - import_dirs = ["${pkglibdir}/imports/gstreamer"], - source_dirs = [], - library_dirs = [@GSTREAMER_LIBDIR_CQ@], - hs_libraries = ["HSgstreamer"], - extra_libraries = [@GSTREAMER_LIBS_CQ@], - include_dirs = [@GSTREAMER_CFLAGS_CQ@], - c_includes = ["gst/gst.h"], - package_deps = ["glib","mtl"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@GSTREAMER_LIBEXTRA_CQ@] -} rmfile ./gstreamer/gstreamer.pkg.in hunk ./gtk/gtk.pkg.in 1 -Package { - name = "gtk", - auto = True, - import_dirs = ["${pkglibdir}/imports/gtk"], - source_dirs = [], - library_dirs = [@GTK_LIBDIR_CQ@], - hs_libraries = ["HSgtk"], - extra_libraries = [@GTK_LIBS_CQ@], - include_dirs = [@GTK_CFLAGS_CQ@], - c_includes = ["gtk/gtk.h"], - package_deps = ["base", "glib" @GTK_CAIRO_DEPEND_NO_CABAL@], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@GTK_LIBEXTRA_CQ@] -} rmfile ./gtk/gtk.pkg.in hunk ./gtkglext/gtkglext.pkg.in 1 -Package { - name = "gtkglext", - auto = True, - import_dirs = ["${pkglibdir}/imports/gtkglext"], - source_dirs = [], - library_dirs = [@GTKGLEXT_LIBDIR_CQ@], - hs_libraries = ["HSgtkglext"], - extra_libraries = [@GTKGLEXT_LIBS_CQ@], - include_dirs = [@GTKGLEXT_CFLAGS_CQ@], - c_includes = ["gtk/gtkgl.h"], - package_deps = ["base", "gtk"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@GTKGLEXT_LIBEXTRA_CQ@] -} rmfile ./gtkglext/gtkglext.pkg.in hunk ./mozembed/mozembed.pkg.in 1 -Package { - name = "mozembed", - auto = True, - import_dirs = ["${pkglibdir}/imports/mozembed"], - source_dirs = [], - library_dirs = [@MOZEMBED_LIBDIR_CQ@], - hs_libraries = ["HSmozembed"], - extra_libraries = [@MOZEMBED_LIBS_CQ@], - include_dirs = [@MOZEMBED_CFLAGS_CQ@], - c_includes = ["gtkmozembed.h"], - package_deps = ["base", "gtk"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@MOZEMBED_LIBEXTRA_CQ@] -} rmfile ./mozembed/mozembed.pkg.in hunk ./soegtk/soegtk.pkg.in 1 -Package { - name = "soegtk", - auto = True, - import_dirs = ["${pkglibdir}/imports/soegtk"], - source_dirs = [], - library_dirs = [@GTK_LIBDIR_CQ@], - hs_libraries = ["HSsoegtk"], - extra_libraries = [], - include_dirs = [], - c_includes = [], - package_deps = ["base", "gtk" @GTK_CAIRO_DEPEND_NO_CABAL@], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [] -} rmfile ./soegtk/soegtk.pkg.in hunk ./sourceview/sourceview.pkg.in 1 -Package { - name = "sourceview", - auto = True, - import_dirs = ["${pkglibdir}/imports/sourceview"], - source_dirs = [], - library_dirs = [@SOURCEVIEW_LIBDIR_CQ@], - hs_libraries = ["HSsourceview"], - extra_libraries = [@SOURCEVIEW_LIBS_CQ@], - include_dirs = [@SOURCEVIEW_CFLAGS_CQ@], - c_includes = ["gtksourceview/gtksourcelanguagesmanager.h", - "gtksourceview/gtksourcetag.h", - "gtksourceview/gtksourceiter.h", - "gtksourceview/gtksourceview.h"], - package_deps = ["base", "gtk"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@SOURCEVIEW_LIBEXTRA_CQ@] -} rmfile ./sourceview/sourceview.pkg.in hunk ./svgcairo/svgcairo.pkg.in 1 -Package { - name = "svgcairo", - auto = True, - import_dirs = ["${pkglibdir}/imports/svgcairo"], - source_dirs = [], - library_dirs = [@SVGCAIRO_LIBDIR_CQ@], - hs_libraries = ["HSsvgcairo"], - extra_libraries = [@SVGCAIRO_LIBS_CQ@], - include_dirs = [@SVGCAIRO_CFLAGS_CQ@], - c_includes = ["librsvg/rsvg-cairo.h", "librsvg/rsvg.h"], - package_deps = ["base", "glib", "cairo"], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [@SVGCAIRO_LIBEXTRA_CQ@] -} rmfile ./svgcairo/svgcairo.pkg.in |
From: Duncan C. <dun...@wo...> - 2007-11-10 18:17:34
|
Mon Oct 29 09:07:49 PDT 2007 Peter Gavin <pg...@gm...> * gstreamer: remove M.S.G.Core.Buffer.bufferWithDataM I need to rethink this one hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 47 - bufferWithDataM, hunk ./gstreamer/Media/Streaming/GStreamer/Core/Buffer.chs.pp 174 -bufferWithDataM :: BufferClass bufferT - => (BS.ByteString -> MiniObjectM bufferT a) - -> MiniObjectM bufferT a -bufferWithDataM action = - do bs <- marshalBufferM $ \bufferPtr -> - do ptr <- {# get GstBuffer->data #} bufferPtr - size <- {# get GstBuffer->size #} bufferPtr -#if __GLASGOW_HASKELL__ < 608 - return $ BS.packCStringLen (castPtr ptr, fromIntegral size) -#else - BS.packCStringLen (castPtr ptr, fromIntegral size) -#endif - result <- action bs - MiniObjectM $ \buffer -> - let (Buffer bufferFPtr) = toBuffer buffer - in touchForeignPtr bufferFPtr - return result - |
From: Duncan C. <dun...@wo...> - 2007-11-08 21:31:47
|
Thu Nov 8 13:23:28 PST 2007 Duncan Coutts <du...@ha...> * Drop support for ghc < 6.4 and clean up There was quite a bit of configuritis needed to support ghc-6.0 and 6.2 hunk ./compat/gtk/Data/Tree.hs 1 ------------------------------------------------------------------------------ --- | --- Module : Data.Tree --- Copyright : (c) The University of Glasgow 2002 --- License : BSD-style (see the file libraries/base/LICENSE) --- [_$_] --- Maintainer : lib...@ha... --- Stability : experimental --- Portability : portable --- --- Multi-way trees (/aka/ rose trees) and forests. --- ------------------------------------------------------------------------------ - -module Data.Tree( - Tree(..), Forest, - -- * Two-dimensional drawing - drawTree, drawForest, - -- * Extraction - flatten, levels, - -- * Building trees - unfoldTree, unfoldForest, - unfoldTreeM, unfoldForestM, - ) where - -import Control.Monad - --- | Multi-way trees, also known as /rose trees/. -data Tree a = Node { - rootLabel :: a, -- ^ label value - subForest :: Forest a -- ^ zero or more child trees - } - deriving (Eq, Read, Show) - -type Forest a = [Tree a] - -instance Functor Tree where - fmap f (Node x ts) = Node (f x) (map (fmap f) ts) - - --- | Neat 2-dimensional drawing of a tree. -drawTree :: Tree String -> String -drawTree = unlines . draw - --- | Neat 2-dimensional drawing of a forest. -drawForest :: Forest String -> String -drawForest = unlines . map drawTree - -draw :: Tree String -> [String] -draw (Node x ts0) = x : drawSubTrees ts0 - where drawSubTrees [] = [] - drawSubTrees [t] = - "|" : shift "`- " " " (draw t) - drawSubTrees (t:ts) = - "|" : shift "+- " "| " (draw t) ++ drawSubTrees ts - - shift first other = zipWith (++) (first : repeat other) - --- | The elements of a tree in pre-order. -flatten :: Tree a -> [a] -flatten t = squish t [] - where squish (Node x ts) xs = x:Prelude.foldr squish xs ts - --- | Lists of nodes at each level of the tree. -levels :: Tree a -> [[a]] -levels t = map (map rootLabel) $ - takeWhile (not . null) $ - iterate (concatMap subForest) [t] - --- | Build a tree from a seed value -unfoldTree :: (b -> (a, [b])) -> b -> Tree a -unfoldTree f b = let (a, bs) = f b in Node a (unfoldForest f bs) - --- | Build a forest from a list of seed values -unfoldForest :: (b -> (a, [b])) -> [b] -> Forest a -unfoldForest f = map (unfoldTree f) - --- | Monadic tree builder, in depth-first order -unfoldTreeM :: Monad m => (b -> m (a, [b])) -> b -> m (Tree a) -unfoldTreeM f b = do - (a, bs) <- f b - ts <- unfoldForestM f bs - return (Node a ts) - --- | Monadic forest builder, in depth-first order -unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a) -unfoldForestM f = Prelude.mapM (unfoldTreeM f) rmfile ./compat/gtk/Data/Tree.hs rmdir ./compat/gtk/Data rmdir ./compat/gtk rmdir ./compat hunk ./Makefile.am 256 -libHSglib_a_CONFIG = glib/glib.$(PKGEXT) +libHSglib_a_CONFIG = glib/glib.package.conf hunk ./Makefile.am 387 -libHSgtk_a_CONFIG = gtk/gtk.$(PKGEXT) -libHSgtk_a_EXTERNALDEPS = base +libHSgtk_a_CONFIG = gtk/gtk.package.conf +libHSgtk_a_EXTERNALDEPS = base mtl-$(PKG_MTL_VERSION) hunk ./Makefile.am 392 -if HAVE_MTL_PACKAGE -libHSgtk_a_EXTERNALDEPS += mtl-$(PKG_MTL_VERSION) -endif hunk ./Makefile.am 402 -if !HAVE_DATA_TREE -libHSgtk_a_SOURCESDIRS += compat/gtk -endif - hunk ./Makefile.am 600 -if !HAVE_DATA_TREE -libHSgtk_a_SOURCES += compat/gtk/Data/Tree.hs -endif - hunk ./Makefile.am 763 -libHSglade_a_CONFIG = glade/glade.$(PKGEXT) +libHSglade_a_CONFIG = glade/glade.package.conf hunk ./Makefile.am 878 -libHSgconf_a_CONFIG = gconf/gconf.$(PKGEXT) +libHSgconf_a_CONFIG = gconf/gconf.package.conf hunk ./Makefile.am 1014 -libHSsourceview_a_CONFIG = sourceview/sourceview.$(PKGEXT) +libHSsourceview_a_CONFIG = sourceview/sourceview.package.conf hunk ./Makefile.am 1140 -libHSmozembed_a_CONFIG = mozembed/mozembed.$(PKGEXT) +libHSmozembed_a_CONFIG = mozembed/mozembed.package.conf hunk ./Makefile.am 1254 -libHScairo_a_CONFIG = cairo/cairo.$(PKGEXT) -libHScairo_a_EXTERNALDEPS = base -if HAVE_MTL_PACKAGE -libHScairo_a_EXTERNALDEPS += mtl-$(PKG_MTL_VERSION) -endif +libHScairo_a_CONFIG = cairo/cairo.package.conf +libHScairo_a_EXTERNALDEPS = base mtl-$(PKG_MTL_VERSION) hunk ./Makefile.am 1388 -libHSsvgcairo_a_CONFIG = svgcairo/svgcairo.$(PKGEXT) -libHSsvgcairo_a_EXTERNALDEPS = base -if HAVE_MTL_PACKAGE -libHSsvgcairo_a_EXTERNALDEPS += mtl-$(PKG_MTL_VERSION) -endif +libHSsvgcairo_a_CONFIG = svgcairo/svgcairo.package.conf +libHSsvgcairo_a_EXTERNALDEPS = base mtl-$(PKG_MTL_VERSION) hunk ./Makefile.am 1484 -libHSgtkglext_a_CONFIG = gtkglext/gtkglext.$(PKGEXT) +libHSgtkglext_a_CONFIG = gtkglext/gtkglext.package.conf hunk ./Makefile.am 1604 -libHSsoegtk_a_CONFIG = soegtk/soegtk.$(PKGEXT) +libHSsoegtk_a_CONFIG = soegtk/soegtk.package.conf hunk ./Makefile.am 1621 -if HAVE_MTL_PACKAGE hunk ./Makefile.am 1622 -endif hunk ./Makefile.am 1688 -libHSgnomevfs_a_CONFIG = gnomevfs/gnomevfs.$(PKGEXT) +libHSgnomevfs_a_CONFIG = gnomevfs/gnomevfs.package.conf hunk ./Makefile.am 1853 -libHSgstreamer_a_CONFIG = gstreamer/gstreamer.$(PKGEXT) +libHSgstreamer_a_CONFIG = gstreamer/gstreamer.package.conf hunk ./Makefile.am 1956 - gstreamer/Media/Streaming/GStreamer/Base/Types.hs + gstreamer/Media/Streaming/GStreamer/Base/Types.hs \ + gstreamer/Media/Streaming/GStreamer/Controller/Types.hs hunk ./Makefile.am 2153 -if USE_NEW_PKG_FORMAT - hunk ./Makefile.am 2163 -else - -package.conf.inplace: - echo "[]" > $@ - $(foreach pkg,$(pkglib_LIBRARIES), \ - $(SED) -e 's|$${pkglibdir}/imports|.|' \ - -e 's|"$${pkglibdir}/include"|.|' \ - -e 's|$${pkglibdir}|.|' \ - -e 's|$${modules}|$(call getModules,$(pkg))|' \ - $(call getVar,$(pkg),CONFIG) \ - | $(GHCPKG) --update-package --input=- --force --config-file=$@; ) - -endif - hunk ./Makefile.am 2337 - $(patsubst %.$(PKGEXT),%.cabal,$(call getVar,$(pkgname),CONFIG)) \ - > $(patsubst %.$(PKGEXT),%.cabal,$(call getVar,$(pkgname),CONFIG)).tmp; \ - mv $(patsubst %.$(PKGEXT),%.cabal,$(call getVar,$(pkgname),CONFIG)).tmp \ - $(patsubst %.$(PKGEXT),%.cabal,$(call getVar,$(pkgname),CONFIG));) + $(patsubst %.package.conf,%.cabal,$(call getVar,$(pkgname),CONFIG)) \ + > $(patsubst %.package.conf,%.cabal,$(call getVar,$(pkgname),CONFIG)).tmp; \ + mv $(patsubst %.package.conf,%.cabal,$(call getVar,$(pkgname),CONFIG)).tmp \ + $(patsubst %.package.conf,%.cabal,$(call getVar,$(pkgname),CONFIG));) hunk ./Makefile.am 2386 -if USE_NEW_PKG_FORMAT - hunk ./Makefile.am 2403 -else !USE_NEW_PKG_FORMAT - -install-data-hook : - $(if $(PKGCONF),if test -f $(PKGCONF); then :; \ - else echo "[]" > $(PKGCONF); fi;) - $(foreach pkgname,$(pkglib_LIBRARIES), \ - $(GHCPKG) $(addprefix --config-file=,$(PKGCONF)) \ - --update-package --force \ - --input-file=$(DESTDIR)$(pkglibdir)/$(patsubst libHS%.a,%.pkg,$(pkgname));) - -uninstall-hook : - $(foreach pkgname,$(pkglib_LIBRARIES), \ - $(GHCPKG) $(addprefix --config-file=,$(PKGCONF)) \ - --remove-package=$(patsubst libHS%.a,%,$(pkgname));) \ - $(if $(PKGCONF),if test -f $(PKGCONF); then \ - if test -n `head $(PKGCONF) | $(GREP) -e "\[\]"`; then \ - rm -f $(PKGCONF) $(PKGCONF).old; fi; \ - fi) - -endif !USE_NEW_PKG_FORMAT - hunk ./acinclude.m4 102 - if test "$USE_NEW_PKG_FORMAT" = "yes"; then - $2=$(echo "${C}" | sed -e 's/,/\n/g' -e 's/[[(), ]]//g' | grep -v '^$' | sed -e 's/[[A-Za-z-]]*//' | sort -r -n | head -n1) - AC_MSG_RESULT([yes, version $$2]) - else - AC_MSG_RESULT(yes) - fi + $2=$(echo "${C}" | sed -e 's/,/\n/g' -e 's/[[(), ]]//g' | grep -v '^$' | sed -e 's/[[A-Za-z-]]*//' | sort -r -n | head -n1) + AC_MSG_RESULT([yes, version $$2]) hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 174 +#if __GLASGOW_HASKELL__ >= 606 hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 177 +#endif hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 247 +#if __GLASGOW_HASKELL__ >= 606 hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 249 +#endif hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 1565 +#if __GLASGOW_HASKELL__ >= 606 hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 1580 +#endif hunk ./configure.ac 103 -You need GHC 6.0 or later.]) +You need GHC 6.4 or later.]) hunk ./configure.ac 113 -GTKHS_PROG_CHECK_VERSION($GHC_VERSION, -lt, 6.0, [ - AC_MSG_ERROR([Gtk2Hs requires GHC 6.0 or later])]) +GTKHS_PROG_CHECK_VERSION($GHC_VERSION, -lt, 6.4, [ + AC_MSG_ERROR([Gtk2Hs requires GHC 6.4 or later])]) hunk ./configure.ac 124 -dnl From ghc 6.4 onwards, ghc-pkg uses a new package format so we must produce -dnl and register .package.conf files instead of the old .pkg files. -GTKHS_PROG_CHECK_VERSION($GHC_VERSION, -ge, 6.4.0, [ -USE_NEW_PKG_FORMAT=yes -HAVE_DATA_TREE=yes -HAVE_MTL_PACKAGE=yes -]) -AM_CONDITIONAL(USE_NEW_PKG_FORMAT, test "$USE_NEW_PKG_FORMAT" = "yes") -if test "$USE_NEW_PKG_FORMAT" = "yes"; then - PKGEXT=package.conf -else - PKGEXT=pkg -fi -AM_CONDITIONAL(HAVE_DATA_TREE, test "$HAVE_DATA_TREE" = "yes") -AM_CONDITIONAL(HAVE_MTL_PACKAGE, test "$HAVE_MTL_PACKAGE" = "yes") -AC_SUBST(USE_NEW_PKG_FORMAT) -AC_SUBST(HAVE_DATA_TREE) -AC_SUBST(HAVE_MTL_PACKAGE) - hunk ./configure.ac 215 -GTKHS_PROG_CHECK_VERSION($GHC_VERSION, -ge, 6.4, [GHC_PKG_CHECK(mtl,PKG_MTL_VERSION)]) +GHC_PKG_CHECK(mtl,PKG_MTL_VERSION) hunk ./configure.ac 217 - -GTKHS_PROG_CHECK_VERSION($GHC_VERSION, -ge, 6.8, [ +if test "$HAVE_SPLIT_BASE" = "yes"; then hunk ./configure.ac 227 -]) +fi hunk ./configure.ac 537 - GTK_CAIRO_DEPEND_NO_CABAL=",\"cairo\""; hunk ./configure.ac 799 -if test "$HAVE_MTL_PACKAGE" = "yes"; then hunk ./configure.ac 800 -else -HADDOCK_PACKAGES="base" -fi hunk ./configure.ac 809 -AC_SUBST(BUILT_IN_C2HS) -AC_SUBST(MULTIPLE_CHS) hunk ./configure.ac 811 -AC_SUBST(PKGEXT) hunk ./configure.ac 824 -AC_SUBST(GTK_CAIRO_DEPEND_NO_CABAL) hunk ./configure.ac 834 -]) - -AC_CONFIG_FILES([ hunk ./configure.ac 840 - glib/glib.pkg - glib/glib.package.conf - glib/glib.cabal - [_$_] - gtk/gtk.pkg - gtk/gtk.package.conf - gtk/gtk.cabal - [_$_] - glade/glade.pkg - glade/glade.package.conf - glade/glade.cabal - [_$_] - gconf/gconf.pkg - gconf/gconf.package.conf - gconf/gconf.cabal - [_$_] - sourceview/sourceview.pkg - sourceview/sourceview.package.conf - sourceview/sourceview.cabal - - mozembed/mozembed.pkg - mozembed/mozembed.package.conf - mozembed/mozembed.cabal - [_$_] - cairo/cairo.pkg - cairo/cairo.package.conf - cairo/cairo.cabal - - svgcairo/svgcairo.pkg - svgcairo/svgcairo.package.conf - svgcairo/svgcairo.cabal - - gtkglext/gtkglext.pkg - gtkglext/gtkglext.package.conf - gtkglext/gtkglext.cabal - - soegtk/soegtk.pkg - soegtk/soegtk.package.conf - soegtk/soegtk.cabal - - gnomevfs/gnomevfs.pkg - gnomevfs/gnomevfs.package.conf - gnomevfs/gnomevfs.cabal - - gstreamer/gstreamer.pkg - gstreamer/gstreamer.package.conf - gstreamer/gstreamer.cabal + glib/glib.package.conf glib/glib.cabal + gtk/gtk.package.conf gtk/gtk.cabal + glade/glade.package.conf glade/glade.cabal + gconf/gconf.package.conf gconf/gconf.cabal + sourceview/sourceview.package.conf sourceview/sourceview.cabal + mozembed/mozembed.package.conf mozembed/mozembed.cabal + cairo/cairo.package.conf cairo/cairo.cabal + svgcairo/svgcairo.package.conf svgcairo/svgcairo.cabal + gtkglext/gtkglext.package.conf gtkglext/gtkglext.cabal + soegtk/soegtk.package.conf soegtk/soegtk.cabal + gnomevfs/gnomevfs.package.conf gnomevfs/gnomevfs.cabal + gstreamer/gstreamer.package.conf gstreamer/gstreamer.cabal hunk ./glib/System/Glib/FFI.hs.pp 33 -#if __GLASGOW_HASKELL__<604 - withArrayLen, -#endif -#if __GLASGOW_HASKELL__<602 - unsafeForeignPtrToPtr, -#endif hunk ./glib/System/Glib/FFI.hs.pp 44 -# if __GLASGOW_HASKELL__>=602 hunk ./glib/System/Glib/FFI.hs.pp 45 -# else -import Foreign hiding (with, free) -# endif hunk ./glib/System/Glib/FFI.hs.pp 49 -#if __GLASGOW_HASKELL__<604 -withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b -withArrayLen elems act = let len = length elems in withArray elems (act len) -#endif - - -#if __GLASGOW_HASKELL__>=602 hunk ./glib/System/Glib/FFI.hs.pp 50 -#endif - -#if __GLASGOW_HASKELL__<602 -unsafeForeignPtrToPtr = foreignPtrToPtr -#endif hunk ./glib/System/Glib/FFI.hs.pp 51 -#if __GLASGOW_HASKELL__>=602 hunk ./glib/System/Glib/FFI.hs.pp 53 -#else -nullForeignPtr :: ForeignPtr a -nullForeignPtr = unsafePerformIO $ newForeignPtr nullPtr freePtr - -foreign import ccall unsafe "&free" - freePtr :: FinalizerPtr a -#endif hunk ./mk/common.mk 33 -if USE_NEW_PKG_FORMAT hunk ./mk/common.mk 35 - $(if $(USE_NEW_PKG_FORMAT),$(addprefix -ignore-package ,$($(PKG)_NAME))) \ + $(addprefix -ignore-package ,$($(PKG)_NAME)) \ hunk ./mk/common.mk 42 -else - -HCFLAGS_PACKAGE_DEPS = \ - -package-conf package.conf.inplace $(HIDE_ALL_PACKAGES) \ - $(if $(USE_NEW_PKG_FORMAT),$(addprefix -ignore-package ,$($(PKG)_NAME))) \ - $(addprefix -package ,$($(PKG)_EXTERNALDEPS)) \ - $(addprefix -package ,$($(PKG)_INTERNALDEPS)) - -HCFLAGS_PACKAGE_NAME = \ - $(addprefix -package-name ,$($(PKG)_NAME)) - -endif - |