*
* If index is not NULL, it is set to the index in the model->notes list
*/
-Resource* notebookmodel_get_note_by_id(NotebookModel *model, int64_t note_id, size_t *index) {
+Note* notebookmodel_get_note_by_id(NotebookModel *model, int64_t note_id, size_t *index) {
CxList *list = model->notes->data; // UiList is based on CxList
CxIterator i = cxListIterator(list);
- cx_foreach(Resource *, note, i) {
+ cx_foreach(Note *, note, i) {
if(note->resource_id == note_id) {
if(index) {
*index = i.index;
void notebookmodel_attach_note(NotebookModel *model, Note *note);
void notebookmodel_detach_current_note(NotebookModel *model);
-Resource* notebookmodel_get_note_by_id(NotebookModel *model, int64_t note_id, size_t *index);
+Note* notebookmodel_get_note_by_id(NotebookModel *model, int64_t note_id, size_t *index);
void notebookmodel_new_note(NotebookModel *model);
void notebookmodel_delete_note(NotebookModel *model);
-NotebookModel* window_get_cached_notebook(MainWindow *window, int64_t collection_id) {
- CxHashKey key = cx_hash_key(&collection_id, sizeof(collection_id));
- return cxMapGet(window->notebook_cache, key);
+NotebookModel* window_get_cached_notebook(MainWindow *window, int64_t collection_resource_id) {
+ return cxMapGet(window->notebook_cache, (uint64_t)collection_resource_id);
}
/*
}
size_t note_index;
- Resource *note = nav->resource_id != 0 ? notebookmodel_get_note_by_id(notebook, nav->resource_id, ¬e_index) : NULL;
+ Note *note = nav->resource_id != 0 ? notebookmodel_get_note_by_id(notebook, nav->resource_id, ¬e_index) : NULL;
window_notelist_setvisible(window, !(nav->view_flags & VIEW_FLAGS_NO_BROWSER));
// reset splitpane visibility
window_notelist_setvisible(window, TRUE);
- CxHashKey key = cx_hash_key(&collection->resource_id, sizeof(collection->resource_id));
- NotebookModel *notebook = cxMapGet(window->notebook_cache, key);
+ NotebookModel *notebook = cxMapGet(window->notebook_cache, (uint64_t)collection->resource_id);
if(!notebook) {
printf("notebook not in cache\n");
notebook = notebookmodel_create();
notebookmodel_set_collection(notebook, collection);
notebookmodel_reload(event->obj, notebook);
- cxMapPut(window->notebook_cache, key, notebook);
+ cxMapPut(window->notebook_cache, (uint64_t)collection->resource_id, notebook);
} else {
printf("notebook in cache\n");
}
void window_notelist_setvisible(MainWindow *window, UiBool visible);
-NotebookModel* window_get_cached_notebook(MainWindow *window, int64_t collection_id);
+NotebookModel* window_get_cached_notebook(MainWindow *window, int64_t collection_resource_id);
void window_navigate(MainWindow *window, NavStack *nav);
struct cx_hash_map_s *hash_map = (struct cx_hash_map_s *) map;
const CxAllocator *allocator = map->collection.allocator;
- unsigned hash = key.hash;
+ uint64_t hash = key.hash;
if (hash == 0) {
cx_hash_murmur(&key);
hash = key.hash;
) {
struct cx_hash_map_s *hash_map = (struct cx_hash_map_s *) map;
- unsigned hash = key.hash;
+ uint64_t hash = key.hash;
if (hash == 0) {
cx_hash_murmur(&key);
hash = key.hash;